cvs: ZendEngine2(PHP_5_2) / zend_execute_API.c /tests bug41633_3.phpt php-src NEWS

From: Date: Wed, 13 Jun 2007 16:48:10 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_execute_API.c /tests bug41633_3.phpt php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5851@lists.php.net to get a copy of this message
dmitry Wed Jun 13 16:48:10 2007 UTC Added files: (Branch: PHP_5_2) /ZendEngine2/tests bug41633_3.phpt Modified files: /php-src NEWS /ZendEngine2 zend_execute_API.c Log: Fixed bug #41633 (Crash instantiating classes with self-referencing constants) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.776&r2=1.2027.2.547.2.777&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.776 php-src/NEWS:1.2027.2.547.2.777 --- php-src/NEWS:1.2027.2.547.2.776 Tue Jun 12 12:53:07 2007 +++ php-src/NEWS Wed Jun 13 16:48:10 2007 @@ -28,6 +28,8 @@ - Fixed bug #41655 (open_basedir bypass via glob()). (Ilia) - Fixed bug #41640 (get_class_vars produces error on class constants). (Johannes) +- Fixed bug #41633 (Crash instantiating classes with self-referencing + constants). (Dmitry) - Fixed bug #41630 (segfault when an invalid color index is present in the image data). (Reported by Elliot <wccoder@gmail dot com>) (Pierre) - Fixed bug #41608 (segfault on a weird code with objects and switch()). http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.22&r2=1.331.2.20.2.23&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.22 ZendEngine2/zend_execute_API.c:1.331.2.20.2.23 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.22 Wed Jun 13 14:50:12 2007 +++ ZendEngine2/zend_execute_API.c Wed Jun 13 16:48:10 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.22 2007/06/13 14:50:12 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.23 2007/06/13 16:48:10 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -448,6 +448,10 @@ #include "../TSRM/tsrm_strtok_r.h" +#define IS_VISITED_CONSTANT IS_CONSTANT_INDEX +#define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT) +#define MARK_CONSTANT_VISITED(p) Z_TYPE_P(p) |= IS_VISITED_CONSTANT + ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) { zval *p = *pp; @@ -455,13 +459,17 @@ zval const_value; char *colon; - if (Z_TYPE_P(p) == IS_CONSTANT) { + if (IS_CONSTANT_VISITED(p)) { + zend_error(E_ERROR, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p)); + } else if (Z_TYPE_P(p) == IS_CONSTANT) { int refcount; zend_uchar is_ref; SEPARATE_ZVAL_IF_NOT_REF(pp); p = *pp; + MARK_CONSTANT_VISITED(p); + refcount = p->refcount; is_ref = p->is_ref; http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug41633_3.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/bug41633_3.phpt +++ ZendEngine2/tests/bug41633_3.phpt

« previous php.zend-engine.cvs (#5851) next »