xref: /PHP-8.2/Zend/tests/objects_021.phpt (revision f8d79582)
1--TEST--
2Testing magic methods __set, __get and __call in cascade
3--FILE--
4<?php
5
6class test {
7    static public $i = 0;
8
9    public function __construct() {
10        self::$i++;
11    }
12
13    public function __set($a, $b) {
14        return x();
15    }
16
17    public function __get($a) {
18        return x();
19    }
20
21    public function __call($a, $b) {
22        return x();
23    }
24}
25
26function x() {
27    return new test;
28}
29
30x()
31    ->a
32        ->b()
33            ->c	= 1;
34
35var_dump(test::$i);
36
37?>
38--EXPECT--
39int(4)
40