xref: /PHP-8.4/Zend/tests/bug74340.phpt (revision 2f92957f)
1--TEST--
2Bug #74340: Magic function __get has different behavior in php 7.1.x
3--FILE--
4<?php
5class Test
6{
7    public function __get($var)
8    {
9        static $first = true;
10        echo '__get '.$var.PHP_EOL;
11        if ($first) {
12            $first = false;
13            $this->$var;
14            $this->{$var.'2'};
15            $this->$var;
16        }
17    }
18}
19
20$test = new Test;
21$test->test;
22
23?>
24--EXPECTF--
25__get test
26
27Warning: Undefined property: Test::$test in %s on line %d
28__get test2
29
30Warning: Undefined property: Test::$test in %s on line %d
31