Re: [PATCH] Zend/zend_alloc.c

From: Date: Wed, 29 Aug 2001 07:23:21 +0000
Subject: Re: [PATCH] Zend/zend_alloc.c
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-64566@lists.php.net to get a copy of this message
There's a big difference between an undefined behavior which may result in a crash, and an organized shutdown.  The former is dangerous, the latter is not.
There are some parts of code that don't rely on this, from the times when it wasn't true, but it doesn't cause any problem, so there's no reason to change it urgently.

Zeev

At 09:54 29-08-01, Walter Franzini wrote:
Stanislav Malyshev <stas@zend.com> 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. Ciao -- Walter Franzini, e-mail: walter@sys-net.it SysNet, Via Digione 8, 27100 Pavia - Italy -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
-- Zeev Suraski <zeev@zend.com> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/

Thread (18 messages)

« previous php.dev (#64566) next »