xref: /PHP-8.1/Zend/tests/ns_064.phpt (revision f8d79582)
1--TEST--
2Magic methods in overridden stdClass inside namespace
3--FILE--
4<?php
5
6namespace test;
7
8class foo {
9    public $e = array();
10
11    public function __construct() {
12        $this->e[] = $this;
13    }
14
15    public function __set($a, $b) {
16        var_dump($a, $b);
17    }
18    public function __get($a) {
19        var_dump($a);
20        return $this;
21    }
22}
23
24use test\foo as stdClass;
25
26$x = new stdClass;
27$x->a = 1;
28$x->b->c = 1;
29$x->d->e[0]->f = 2;
30
31?>
32--EXPECT--
33string(1) "a"
34int(1)
35string(1) "b"
36string(1) "c"
37int(1)
38string(1) "d"
39string(1) "f"
40int(2)
41