]> granicus.if.org Git - php/commitdiff
Added test for (long-ago fixed) bug #70083
authorBob Weinand <bobwei9@hotmail.com>
Tue, 22 Dec 2015 16:39:36 +0000 (17:39 +0100)
committerBob Weinand <bobwei9@hotmail.com>
Tue, 22 Dec 2015 16:39:36 +0000 (17:39 +0100)
Zend/tests/bug70083.phpt [new file with mode: 0644]

diff --git a/Zend/tests/bug70083.phpt b/Zend/tests/bug70083.phpt
new file mode 100644 (file)
index 0000000..0391ea2
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+Bug #70083 (Use after free with assign by ref to overloaded objects)
+--FILE--
+<?php
+
+class foo {
+       private $var;
+       function __get($e) {
+               return $this;
+       }
+}
+
+function &noref() { $foo = 1; return $foo; }
+
+$foo = new foo;
+$foo->i = &noref();
+var_dump($foo);
+
+?>
+--EXPECTF--
+
+Fatal error: Uncaught Error: Cannot assign by reference to overloaded object in %s:%d
+Stack trace:
+#0 {main}
+  thrown in %s on line %d
+