]> granicus.if.org Git - php/commitdiff
Backport tests
authorDmitry Stogov <dmitry@zend.com>
Thu, 26 Oct 2017 11:12:08 +0000 (14:12 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 26 Oct 2017 11:12:08 +0000 (14:12 +0300)
Zend/tests/bug75420.7.phpt [new file with mode: 0644]
Zend/tests/bug75420.8.phpt [new file with mode: 0644]

diff --git a/Zend/tests/bug75420.7.phpt b/Zend/tests/bug75420.7.phpt
new file mode 100644 (file)
index 0000000..0b9743a
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Bug #75420.7 (Indirect modification of magic method argument)
+--FILE--
+<?php
+class Test {
+       public function __set($x,$v) { $GLOBALS["name"] = 24; var_dump($x); }
+}
+
+$obj = new Test;
+$name = "foo";
+$name = str_repeat($name, 2);
+$obj->$name = 1;
+var_dump($name);
+?>
+--EXPECT--
+string(6) "foofoo"
+int(24)
diff --git a/Zend/tests/bug75420.8.phpt b/Zend/tests/bug75420.8.phpt
new file mode 100644 (file)
index 0000000..2d57c8b
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Bug #75420.8 (Indirect modification of magic method argument)
+--FILE--
+<?php
+class Test {
+       public function __set($x,$v) { $GLOBALS["obj"] = 24; var_dump($this); }
+}
+
+$obj = new Test;
+$name = "foo";
+$obj->$name = 1;
+var_dump($obj);
+?>
+--EXPECT--
+object(Test)#1 (0) {
+}
+int(24)