|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-13 21:40 UTC] helly@php.net
[2004-07-13 21:40 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 12:00:01 2025 UTC |
Description: ------------ If a constant in a define() call is already defined, Zend engine issues a warning with E_NOTICE set. This warning code might use memory after it's freed. This can cause interpreter crash, especially under threaded Apache 2.x. Following fixes the problem (this patch is in NetBSD pkgsrc ATM): --- Zend/zend_constants.c.orig 2004-07-13 14:01:27.000000000 +0200 +++ Zend/zend_constants.c 2004-07-13 14:01:54.000000000 +0200 @@ -265,11 +265,11 @@ } if (zend_hash_add(EG(zend_constants), name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) { + zend_error(E_NOTICE,"Constant %s already defined", name); free(c->name); if (!(c->flags & CONST_PERSISTENT)) { zval_dtor(&c->value); } - zend_error(E_NOTICE,"Constant %s already defined", name); ret = FAILURE; } if (lowercase_name) { Reproduce code: --------------- Under NetBSD, switch on extended malloc() debugging, by telling malloc to fill free()d values with junk: ln -s J /etc/malloc.conf then, run: php -r 'error_reporting(E_ALL); define("foo", "j"); define("foo", "j");' see something along: PHP Notice: Constant ÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐÐ in Command line code on line 1