com php-src: Don't xfail method_static_var.phpt: Zend /tests/method_static_var.phpt
| From: | Nikita Popov | Date: | Wed, 04 Nov 2020 11:30:41 +0000 |
| Subject: | com php-src: Don't xfail method_static_var.phpt: Zend /tests/method_static_var.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-114059@lists.php.net to get a copy of this message | ||
Commit: 57b0e5a0455e621bec7acfbf57fb3da8776d1465
Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 4 Nov 2020 12:30:41 +0100
Parents: 9ed2f4898bc0d53c57b2ebd5871d68e74811a46d
Branches: PHP-8.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=57b0e5a0455e621bec7acfbf57fb3da8776d1465
Log:
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...
Changed paths:
M Zend/tests/method_static_var.phpt
Diff:
diff --git a/Zend/tests/method_static_var.phpt b/Zend/tests/method_static_var.phpt
index b419647517d..06574732d75 100644
--- a/Zend/tests/method_static_var.phpt
+++ b/Zend/tests/method_static_var.phpt
@@ -1,31 +1,26 @@
--TEST--
Initial value of static var in method depends on the include time of the class definition
---XFAIL--
-Maybe not a bug
--FILE--
<?php
+
+/* The current behavior is probably a bug, but we should still test how it currently works. */
+
class Foo {
- public function __construct() {
- eval("class Bar extends Foo {}");
- }
- public static function test() {
- static $i = 0;
- var_dump(++$i);
- }
+ public static function test() {
+ static $i = 0;
+ var_dump(++$i);
+ }
}
-foo::test();
-new Foo;
-foo::test();
+Foo::test();
+eval("class Bar extends Foo {}");
+Foo::test();
-/**
- * function_add_ref() makes a clone of static variables for inherited functions, so $i in Bar::test
gets initial value 1
- */
Bar::test();
Bar::test();
?>
--EXPECT--
int(1)
int(2)
-int(1)
int(2)
+int(3)