Annotation of embedaddon/php/Zend/tests/method_static_var.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Initial value of static var in method depends on the include time of the class definition
! 3: --XFAIL--
! 4: Maybe not a bug
! 5: --FILE--
! 6: <?php
! 7: class Foo {
! 8: public function __construct() {
! 9: eval("class Bar extends Foo {}");
! 10: }
! 11: public static function test() {
! 12: static $i = 0;
! 13: var_dump(++$i);
! 14: }
! 15: }
! 16:
! 17: foo::test();
! 18: new Foo;
! 19: foo::test();
! 20:
! 21: /**
! 22: * function_add_ref() makes a clone of static variables for inherited functions, so $i in Bar::test gets initial value 1
! 23: */
! 24: Bar::test();
! 25: Bar::test();
! 26: --EXPECT--
! 27: int(1)
! 28: int(2)
! 29: int(1)
! 30: int(2)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>