cvs: ZendEngine2(PHP_5_3) / zend_compile.c /tests errmsg_024.phpt lsb_019.phpt lsb_020.phpt php-src/ext/reflection/tests static_properties_002.phpt
php-src/tests/classes property_override_protectedStatic_publicStatic.phpt

From: Date: Mon, 03 Mar 2008 15:07:05 +0000
Subject: cvs: ZendEngine2(PHP_5_3) / zend_compile.c /tests errmsg_024.phpt lsb_019.phpt lsb_020.phpt php-src/ext/reflection/tests static_properties_002.phpt
php-src/tests/classes property_override_protectedStatic_publicStatic.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6461@lists.php.net to get a copy of this message
robinf Mon Mar 3 15:07:05 2008 UTC Added files: (Branch: PHP_5_3) /ZendEngine2/tests lsb_020.phpt lsb_019.phpt Modified files: /php-src/ext/reflection/tests static_properties_002.phpt /ZendEngine2/tests errmsg_024.phpt /php-src/tests/classes property_override_protectedStatic_publicStatic.phpt /ZendEngine2 zend_compile.c Log: Remove inconsistent behaviour when a protected static prop is overridden by public static prop (details: http://turl.ca/phhhf ). http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/static_properties_002.phpt?r1=1.2.4.1&r2=1.2.4.1.4.1&diff_format=u Index: php-src/ext/reflection/tests/static_properties_002.phpt diff -u php-src/ext/reflection/tests/static_properties_002.phpt:1.2.4.1 php-src/ext/reflection/tests/static_properties_002.phpt:1.2.4.1.4.1 --- php-src/ext/reflection/tests/static_properties_002.phpt:1.2.4.1 Sun Mar 12 12:38:25 2006 +++ php-src/ext/reflection/tests/static_properties_002.phpt Mon Mar 3 15:07:04 2008 @@ -19,7 +19,7 @@ } class derived extends base { - static public $prop; + static public $prop = 2; static function show() { echo __METHOD__ . '(' . self::$prop . ")\n"; @@ -54,9 +54,9 @@ derived::show(2) base::inc() base::show(3) -derived::show(3) +derived::show(2) derived::inc() -base::show(4) -derived::show(4) +base::show(3) +derived::show(3) Number of properties: 1 -Done +Done \ No newline at end of file http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/errmsg_024.phpt?r1=1.1.2.2&r2=1.1.2.2.2.1&diff_format=u Index: ZendEngine2/tests/errmsg_024.phpt diff -u ZendEngine2/tests/errmsg_024.phpt:1.1.2.2 ZendEngine2/tests/errmsg_024.phpt:1.1.2.2.2.1 --- ZendEngine2/tests/errmsg_024.phpt:1.1.2.2 Wed Feb 7 11:10:32 2007 +++ ZendEngine2/tests/errmsg_024.phpt Mon Mar 3 15:07:04 2008 @@ -1,5 +1,5 @@ --TEST-- -errmsg: cannot change initial value of property +No more errmsg: can now change initial value of property --FILE-- <?php @@ -14,4 +14,4 @@ echo "Done\n"; ?> --EXPECTF-- -Fatal error: Cannot change initial value of property static protected test1::$var in class test in %s on line %d +Done http://cvs.php.net/viewvc.cgi/php-src/tests/classes/property_override_protectedStatic_publicStatic.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/tests/classes/property_override_protectedStatic_publicStatic.phpt diff -u php-src/tests/classes/property_override_protectedStatic_publicStatic.phpt:1.1.4.2 php-src/tests/classes/property_override_protectedStatic_publicStatic.phpt:1.1.4.3 --- php-src/tests/classes/property_override_protectedStatic_publicStatic.phpt:1.1.4.2 Wed Jan 30 14:25:42 2008 +++ php-src/tests/classes/property_override_protectedStatic_publicStatic.phpt Mon Mar 3 15:07:04 2008 @@ -27,5 +27,7 @@ B::showB(); ?> --EXPECTF-- +A::p (static) +A::p (static) +B::p (static) -Fatal error: Cannot change initial value of property static protected A::$p in class B in %s on line 18 http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.45&r2=1.647.2.27.2.41.2.46&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.45 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.46 --- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.45 Sat Mar 1 13:53:32 2008 +++ ZendEngine2/zend_compile.c Mon Mar 3 15:07:04 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.45 2008/03/01 13:53:32 johannes Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.46 2008/03/03 15:07:04 robinf Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -2482,18 +2482,6 @@ ht = &parent_ce->default_static_members; } if (zend_hash_find(ht, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) { - zval **new_prop; - if (zend_hash_find(&ce->default_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, child_info->name_length, &tmp, &prop_name); - - zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %s::$%s in class %s", - parent_ce->name, prop_name, ce->name); - } - } - Z_ADDREF_PP(prop); - zend_hash_update(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL); zend_hash_del(&ce->default_static_members, prot_name, prot_name_length+1); } } else { http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/lsb_020.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/lsb_020.phpt +++ ZendEngine2/tests/lsb_020.phpt --TEST-- Test LSB of properties and methods declared as public and overridden as public. --FILE-- <?php class TestClass { public static $staticVar; public static function staticFunction() { return 'TestClassFunction'; } public static function testStaticVar() { TestClass::$staticVar = 'TestClassStatic'; ChildClass1::$staticVar = 'ChildClassStatic'; return static::$staticVar; } public static function testStaticFunction() { return static::staticFunction(); } } class ChildClass1 extends TestClass { public static $staticVar; public static function staticFunction() { return 'ChildClassFunction'; } } class ChildClass2 extends TestClass {} echo TestClass::testStaticVar() . "\n"; echo TestClass::testStaticFunction() . "\n"; echo ChildClass1::testStaticVar() . "\n"; echo ChildClass1::testStaticFunction() . "\n"; echo ChildClass2::testStaticVar() . "\n"; echo ChildClass2::testStaticFunction() . "\n"; ?> --EXPECTF-- TestClassStatic TestClassFunction ChildClassStatic ChildClassFunction TestClassStatic TestClassFunction http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/lsb_019.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/lsb_019.phpt +++ ZendEngine2/tests/lsb_019.phpt --TEST-- Test LSB of properties and methods declared as protected and overridden as public. --FILE-- <?php class TestClass { protected static $staticVar; protected static function staticFunction() { return 'TestClassFunction'; } public static function testStaticVar() { TestClass::$staticVar = 'TestClassStatic'; ChildClass1::$staticVar = 'ChildClassStatic'; return static::$staticVar; } public static function testStaticFunction() { return static::staticFunction(); } } class ChildClass1 extends TestClass { public static $staticVar; public static function staticFunction() { return 'ChildClassFunction'; } } class ChildClass2 extends TestClass {} echo TestClass::testStaticVar() . "\n"; echo TestClass::testStaticFunction() . "\n"; echo ChildClass1::testStaticVar() . "\n"; echo ChildClass1::testStaticFunction() . "\n"; echo ChildClass2::testStaticVar() . "\n"; echo ChildClass2::testStaticFunction() . "\n"; ?> --EXPECTF-- TestClassStatic TestClassFunction ChildClassStatic ChildClassFunction TestClassStatic TestClassFunction

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