jani Sat, 01 Aug 2009 01:01:43 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=286606
Log: - Added test for bug #49074 Bug: http://bugs.php.net/49074 (Closed) private class static fields can be modified by using reflection Changed paths: A php/php-src/branches/PHP_5_2/ext/reflection/tests/bug49074.phpt A php/php-src/branches/PHP_5_3/ext/reflection/tests/bug49074.phpt A php/php-src/trunk/ext/reflection/tests/bug49074.phpt Added: php/php-src/branches/PHP_5_2/ext/reflection/tests/bug49074.phpt =================================================================== --- php/php-src/branches/PHP_5_2/ext/reflection/tests/bug49074.phpt (rev 0) +++ php/php-src/branches/PHP_5_2/ext/reflection/tests/bug49074.phpt 2009-08-01 01:01:43 UTC (rev 286606) @@ -0,0 +1,35 @@ +--TEST-- +Bug #49074 (private class static fields can be modified by using reflection) +--FILE-- +<?php +class Test { + private static $data1 = 1; + private static $data4 = 4; +} + +class Test2 extends Test { + private static $data2 = 2; + public static $data3 = 3; +} + +$r = new ReflectionClass('Test2'); +$m = $r->getStaticProperties(); + +$m['data1'] = 100; +$m['data2'] = 200; +$m['data3'] = 300; +$m['data4'] = 400; + +var_dump($r->getStaticProperties()); +?> +--EXPECT-- +array(4) { + ["data2"]=> + int(2) + ["data3"]=> + int(3) + ["data1"]=> + int(1) + ["data4"]=> + int(4) +} Added: php/php-src/branches/PHP_5_3/ext/reflection/tests/bug49074.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/reflection/tests/bug49074.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/reflection/tests/bug49074.phpt 2009-08-01 01:01:43 UTC (rev 286606) @@ -0,0 +1,35 @@ +--TEST-- +Bug #49074 (private class static fields can be modified by using reflection) +--FILE-- +<?php +class Test { + private static $data1 = 1; + private static $data4 = 4; +} + +class Test2 extends Test { + private static $data2 = 2; + public static $data3 = 3; +} + +$r = new ReflectionClass('Test2'); +$m = $r->getStaticProperties(); + +$m['data1'] = 100; +$m['data2'] = 200; +$m['data3'] = 300; +$m['data4'] = 400; + +var_dump($r->getStaticProperties()); +?> +--EXPECT-- +array(4) { + ["data2"]=> + int(2) + ["data3"]=> + int(3) + ["data1"]=> + int(1) + ["data4"]=> + int(4) +} Added: php/php-src/trunk/ext/reflection/tests/bug49074.phpt =================================================================== --- php/php-src/trunk/ext/reflection/tests/bug49074.phpt (rev 0) +++ php/php-src/trunk/ext/reflection/tests/bug49074.phpt 2009-08-01 01:01:43 UTC (rev 286606) @@ -0,0 +1,35 @@ +--TEST-- +Bug #49074 (private class static fields can be modified by using reflection) +--FILE-- +<?php +class Test { + private static $data1 = 1; + private static $data4 = 4; +} + +class Test2 extends Test { + private static $data2 = 2; + public static $data3 = 3; +} + +$r = new ReflectionClass('Test2'); +$m = $r->getStaticProperties(); + +$m['data1'] = 100; +$m['data2'] = 200; +$m['data3'] = 300; +$m['data4'] = 400; + +var_dump($r->getStaticProperties()); +?> +--EXPECT-- +array(4) { + [u"data2"]=> + int(2) + [u"data3"]=> + int(3) + [u"data1"]=> + int(1) + [u"data4"]=> + int(4) +}
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
