xref: /PHP-8.1/Zend/tests/bug76667.phpt (revision 31ef94cd)
1--TEST--
2Bug #76667 (Segfault with divide-assign op and __get + __set)
3--FILE--
4<?php
5
6class T {
7    public function __get($k)
8    {
9        return $undefined->$k;
10    }
11
12    public function __set($k, $v)
13    {
14        return $this->$v /= 0;
15    }
16}
17
18$x = new T;
19try {
20    $x->x = 1;
21} catch (\DivisionByZeroError $e) {
22    echo $e->getMessage() . \PHP_EOL;
23}
24?>
25--EXPECTF--
26Warning: Undefined variable $undefined in %s on line %d
27
28Warning: Attempt to read property "1" on null in %s on line %d
29Division by zero
30