All pastes #919094 Raw Edit

Stuff

public diff v1 · immutable
#919094 ·published 2008-02-26 16:20 UTC
rendered paste body
diff -Naur php6.0-200802251530.org/Zend/zend_compile.c php6.0-200802251530.mod/Zend/zend_compile.c--- php6.0-200802251530.org/Zend/zend_compile.c	2008-02-26 16:00:02.500000000 +0000+++ php6.0-200802251530.mod/Zend/zend_compile.c	2008-02-26 15:59:30.671875000 +0000@@ -2688,7 +2688,6 @@ 			if (child_info->flags & ZEND_ACC_STATIC) { 				zval **prop; 				HashTable *ht;- 				if (parent_ce->type != ce->type) { 					/* User class extends internal class */ 					ht = CE_STATIC_MEMBERS(parent_ce);@@ -2696,18 +2695,6 @@ 					ht = &parent_ce->default_static_members; 				} 				if (zend_u_hash_find(ht, utype, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) {-					zval **new_prop;-					if (zend_u_hash_find(&ce->default_static_members, utype, 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) {-							zstr prop_name, tmp;--							zend_u_unmangle_property_name(utype, child_info->name, child_info->name_length, &tmp, &prop_name);-							zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %v::$%v in class %v",-								parent_ce->name, prop_name, ce->name);-						}-					}-					Z_ADDREF_PP(prop);-					zend_u_hash_update(&ce->default_static_members, utype, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL); 					zend_u_hash_del(&ce->default_static_members, utype, prot_name, prot_name_length+1); 				} 			} else {@@ -5674,3 +5661,4 @@  * indent-tabs-mode: t  * End:  */+diff -Naur php6.0-200802251530.org/ext/reflection/tests/static_properties_002.phpt php6.0-200802251530.mod/ext/reflection/tests/static_properties_002.phpt--- php6.0-200802251530.org/ext/reflection/tests/static_properties_002.phpt	2008-02-26 16:01:20.343750000 +0000+++ php6.0-200802251530.mod/ext/reflection/tests/static_properties_002.phpt	2008-02-26 16:01:14.718750000 +0000@@ -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 filediff -Naur php6.0-200802251530.org/tests/classes/property_override_protectedStatic_publicStatic.phpt php6.0-200802251530.mod/tests/classes/property_override_protectedStatic_publicStatic.phpt--- php6.0-200802251530.org/tests/classes/property_override_protectedStatic_publicStatic.phpt	2008-02-26 16:01:50.703125000 +0000+++ php6.0-200802251530.mod/tests/classes/property_override_protectedStatic_publicStatic.phpt	2008-02-26 13:49:02.187500000 +0000@@ -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 18diff -Naur php6.0-200802251530.org/Zend/tests/errmsg_024.phpt php6.0-200802251530.mod/Zend/tests/errmsg_024.phpt--- php6.0-200802251530.org/Zend/tests/errmsg_024.phpt	2008-02-26 16:00:09.812500000 +0000+++ php6.0-200802251530.mod/Zend/tests/errmsg_024.phpt	2008-02-26 13:16:46.312500000 +0000@@ -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+Donediff -Naur php6.0-200802251530.org/Zend/tests/lsb_019.phpt php6.0-200802251530.mod/Zend/tests/lsb_019.phpt--- php6.0-200802251530.org/Zend/tests/lsb_019.phpt	1970-01-01 00:00:00.000000000 +0000+++ php6.0-200802251530.mod/Zend/tests/lsb_019.phpt	2008-02-26 16:00:54.250000000 +0000@@ -0,0 +1,48 @@+--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\ No newline at end of filediff -Naur php6.0-200802251530.org/Zend/tests/lsb_020.phpt php6.0-200802251530.mod/Zend/tests/lsb_020.phpt--- php6.0-200802251530.org/Zend/tests/lsb_020.phpt	1970-01-01 00:00:00.000000000 +0000+++ php6.0-200802251530.mod/Zend/tests/lsb_020.phpt	2008-02-26 16:00:57.968750000 +0000@@ -0,0 +1,48 @@+--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\ No newline at end of file