Expected Test Failure Report for Zend/tests/method_static_var.phpt ('Initial value of static var in method depends on the include time of the class definition')
Script
1:
<?php 2: class Foo { 3: public function __construct() { 4: eval("class Bar extends Foo {}"); 5: } 6: public static function test() { 7: static $i = 0; 8: var_dump(++$i); 9: } 10: } 11: 12: foo::test(); 13: new Foo; 14: foo::test(); 15: 16: /** 17: * function_add_ref() makes a clone of static variables for inherited functions, so $i in Bar::test gets initial value 1 18: */ 19: Bar::test(); 20: Bar::test(); 21:
Expected
int(1)
int(2)
int(1)
int(2)
Output
int(1)
int(2)
int(2)
int(3)
Diff
003- int(1)
004+ int(3)
Generated at Fri, 17 May 2013 23:23:52 +0000 (2 days ago)
|