xref: /PHP-7.2/Zend/tests/bug70083.phpt (revision f1d7e3ca)
1--TEST--
2Bug #70083 (Use after free with assign by ref to overloaded objects)
3--FILE--
4<?php
5
6class foo {
7	private $var;
8	function __get($e) {
9		return $this;
10	}
11}
12
13function &noref() { $foo = 1; return $foo; }
14
15$foo = new foo;
16$foo->i = &noref();
17var_dump($foo);
18
19?>
20--EXPECTF--
21Fatal error: Uncaught Error: Cannot assign by reference to overloaded object in %s:%d
22Stack trace:
23#0 {main}
24  thrown in %s on line %d
25