xref: /PHP-8.1/Zend/tests/bug69732.phpt (revision 7aacc705)
1--TEST--
2Bug #69732 (can induce segmentation fault with basic php code)
3--FILE--
4<?php
5class wpq {
6    private $unreferenced;
7
8    public function __get($name) {
9        return $this->$name . "XXX";
10    }
11}
12
13function ret_assoc() {
14    $x = "XXX";
15    return array('foo' => 'bar', $x);
16}
17
18$wpq = new wpq;
19$wpq->interesting =& ret_assoc();
20$x = $wpq->interesting;
21printf("%s\n", $x);
22?>
23--EXPECTF--
24Warning: Undefined property: wpq::$interesting in %s on line %d
25
26Notice: Indirect modification of overloaded property wpq::$interesting has no effect in %sbug69732.php on line 16
27
28Fatal error: Uncaught Error: Cannot assign by reference to overloaded object in %s:%d
29Stack trace:
30#0 {main}
31  thrown in %s on line %d
32