Stanislav Malyshev <[EMAIL PROTECTED]> writes:

> JG>> I disagree with this patch. The scenario of not being able to
> JG>> allocate memory is a fatal error, and the only appropriate
> JG>> response for php is to exit. If you need other behavior use
> JG>> pemalloc( which calls malloc if set persistant ).
> Actually, there's a lot of code in PHP that is based on the assumption
> that emalloc never fails. If emalloc can return NULLs, all this code
> should be rewritten. I do not see any point in it and agree with Jason.

You are right, but this "feature" (emalloc never fails) is
undocumented and both php and zend are full of code that just check the
emalloc return value.  You can find some example also in zend_alloc.c.

Changing emalloc to return NULLs does not modify the program
behaviour: you (probably) receive a SIGSEGV from the emalloc caller
and the execution terminate.  I can't see a big difference in this
case, but if you check for NULL you can fail gracefully.

Walter Franzini, e-mail: [EMAIL PROTECTED]
SysNet, Via Digione 8, 27100 Pavia - Italy

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to