xref: /PHP-5.4/Zend/tests/method_static_var.phpt (revision 95784cf6)
1--TEST--
2Initial value of static var in method depends on the include time of the class definition
3--XFAIL--
4Maybe not a bug
5--FILE--
6<?php
7class 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
17foo::test();
18new Foo;
19foo::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 */
24Bar::test();
25Bar::test();
26--EXPECT--
27int(1)
28int(2)
29int(1)
30int(2)
31