summaryrefslogtreecommitdiff
path: root/Zend/tests
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests')
-rw-r--r--Zend/tests/anon/015.phpt33
-rw-r--r--Zend/tests/anon/016.phpt35
2 files changed, 68 insertions, 0 deletions
diff --git a/Zend/tests/anon/015.phpt b/Zend/tests/anon/015.phpt
new file mode 100644
index 0000000000..324ebe880a
--- /dev/null
+++ b/Zend/tests/anon/015.phpt
@@ -0,0 +1,33 @@
+--TEST--
+static variables in methods inherited from parent class
+--FILE--
+<?php
+class C {
+ function foo ($y = null) {
+ static $x = null;
+ if (!is_null($y)) {
+ $x = [$y];
+ }
+ return $x;
+ }
+}
+$c = new C();
+$c->foo(42);
+$d = new class extends C {};
+var_dump($d->foo());
+var_dump($d->foo(24));
+var_dump($c->foo());
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ int(42)
+}
+array(1) {
+ [0]=>
+ int(24)
+}
+array(1) {
+ [0]=>
+ int(42)
+}
diff --git a/Zend/tests/anon/016.phpt b/Zend/tests/anon/016.phpt
new file mode 100644
index 0000000000..4cde6dfeab
--- /dev/null
+++ b/Zend/tests/anon/016.phpt
@@ -0,0 +1,35 @@
+--TEST--
+static variables in methods inherited from parent class (can't cache objects)
+--FILE--
+<?php
+class C {
+ function foo ($y = null) {
+ static $x = null;
+ if (!is_null($y)) {
+ $x = [$y];
+ }
+ return $x;
+ }
+}
+$c = new C();
+$c->foo(new stdClass);
+$d = new class extends C {};
+var_dump($d->foo());
+var_dump($d->foo(24));
+var_dump($c->foo());
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ object(stdClass)#2 (0) {
+ }
+}
+array(1) {
+ [0]=>
+ int(24)
+}
+array(1) {
+ [0]=>
+ object(stdClass)#2 (0) {
+ }
+}