Skip to content

Commit 57b0e5a

Browse files
committed
Don't xfail method_static_var.phpt
Let's test the current behavior here. It might not be right, but it's long-standing behavior. Nearly missed an assertion failure here because the test was XFAILed...
1 parent 9ed2f48 commit 57b0e5a

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

Zend/tests/method_static_var.phpt

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
11
--TEST--
22
Initial value of static var in method depends on the include time of the class definition
3-
--XFAIL--
4-
Maybe not a bug
53
--FILE--
64
<?php
5+
6+
/* The current behavior is probably a bug, but we should still test how it currently works. */
7+
78
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-
}
9+
public static function test() {
10+
static $i = 0;
11+
var_dump(++$i);
12+
}
1513
}
1614

17-
foo::test();
18-
new Foo;
19-
foo::test();
15+
Foo::test();
16+
eval("class Bar extends Foo {}");
17+
Foo::test();
2018

21-
/**
22-
* function_add_ref() makes a clone of static variables for inherited functions, so $i in Bar::test gets initial value 1
23-
*/
2419
Bar::test();
2520
Bar::test();
2621
?>
2722
--EXPECT--
2823
int(1)
2924
int(2)
30-
int(1)
3125
int(2)
26+
int(3)

0 commit comments

Comments
 (0)