cvs: ZendEngine2 / zend_compile.c /tests bug27145.phpt

From: Date: Thu, 05 Feb 2004 02:16:08 +0000
Subject: cvs: ZendEngine2 / zend_compile.c /tests bug27145.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2329@lists.php.net to get a copy of this message
iliaa Wed Feb 4 21:16:08 2004 EDT Added files: /ZendEngine2/tests bug27145.phpt Modified files: /ZendEngine2 zend_compile.c Log: Fixed bug #27145 (Unmangle private/protected property names before printing then inside error messages). http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.536&r2=1.537&ty=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.536 ZendEngine2/zend_compile.c:1.537 --- ZendEngine2/zend_compile.c:1.536 Wed Feb 4 13:24:44 2004 +++ ZendEngine2/zend_compile.c Wed Feb 4 21:16:07 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.536 2004/02/04 18:24:44 zeev Exp $ */ +/* $Id: zend_compile.c,v 1.537 2004/02/05 02:16:07 iliaa Exp $ */ #include "zend_language_parser.h" #include "zend.h" @@ -1859,8 +1859,11 @@ zval **new_prop; if (zend_hash_find(ce->static_members, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) { if (Z_TYPE_PP(new_prop) != IS_NULL && Z_TYPE_PP(prop) != IS_NULL) { + char *prop_name, *tmp; + zend_unmangle_property_name(child_info->name, &tmp, &prop_name); + zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %s::$%s in class %s", - parent_ce->name, child_info->name, ce->name); + parent_ce->name, prop_name, ce->name); } } (*prop)->refcount++; @@ -1872,8 +1875,11 @@ } pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); } else if (!(child_info->flags & ZEND_ACC_PRIVATE) && (child_info->flags & ZEND_ACC_STATIC)) { + char *prop_name, *tmp; + + zend_unmangle_property_name(child_info->name, &tmp, &prop_name); zend_error(E_COMPILE_ERROR, "Cannot redeclare property static %s %s::$%s in class %s", - zend_visibility_string(child_info->flags), parent_ce->name, child_info->name, ce->name); + zend_visibility_string(child_info->flags), parent_ce->name, prop_name, ce->name); } return 0; /* Don't copy from parent */ } else { http://cvs.php.net/co.php/ZendEngine2/tests/bug27145.phpt?r=1.1&p=1 Index: ZendEngine2/tests/bug27145.phpt +++ ZendEngine2/tests/bug27145.phpt --TEST-- Bug #27145 (Errors messages print unmangled PPP property names) --FILE-- <?php class a { protected static $v = "aa"; } class b extends a { protected static $v = "bb"; } ?> --EXPECTF-- Fatal error: Cannot redeclare property static protected a::$v in class b in %s on line %d

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