cvs: ZendEngine2 / zend_compile.c

From: Date: Wed, 03 Sep 2003 16:34:35 +0000
Subject: cvs: ZendEngine2 / zend_compile.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-1801@lists.php.net to get a copy of this message
helly Wed Sep 3 12:34:35 2003 EDT Modified files: /ZendEngine2 zend_compile.c Log: Add missing error messages when violating static property inheritance rules. Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.475 ZendEngine2/zend_compile.c:1.476 --- ZendEngine2/zend_compile.c:1.475 Wed Sep 3 12:13:40 2003 +++ ZendEngine2/zend_compile.c Wed Sep 3 12:34:35 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.475 2003/09/03 16:13:40 helly Exp $ */ +/* $Id: zend_compile.c,v 1.476 2003/09/03 16:34:35 helly Exp $ */ #include "zend_language_parser.h" #include "zend.h" @@ -1770,6 +1770,13 @@ if (child_info->flags & ZEND_ACC_STATIC) { zval **prop; if (zend_hash_find(parent_ce->static_members, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) { + 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) { + 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); + } + } (*prop)->refcount++; zend_hash_update(ce->static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL); zend_hash_del(ce->static_members, prot_name, prot_name_length+1); @@ -1778,6 +1785,9 @@ zend_hash_del(&ce->default_properties, prot_name, prot_name_length+1); } pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); + } else if (!(child_info->flags & ZEND_ACC_PRIVATE) && (child_info->flags & ZEND_ACC_STATIC)) { + 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); } return 0; /* Don't copy from parent */ } else {

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