xref: /PHP-8.2/Zend/tests/this_in_isset.phpt (revision f8d79582)
1--TEST--
2$this in isset
3--FILE--
4<?php
5var_dump(isset($this));
6try {
7    var_dump(isset($this->foo));
8} catch (Throwable $e) {
9    echo "exception\n";
10}
11try {
12    var_dump(isset($this->foo->bar));
13} catch (Throwable $e) {
14    echo "exception\n";
15}
16try {
17    var_dump(isset($this[0]));
18} catch (Throwable $e) {
19    echo "exception\n";
20}
21
22class A extends ArrayObject {
23    public $foo = 5;
24    function foo() {
25        $this[0] = 5;
26        var_dump(isset($this));
27        var_dump(isset($this->foo));
28        var_dump(isset($this[0]));
29    }
30}
31$a = new A();
32$a->foo();
33?>
34--EXPECT--
35bool(false)
36exception
37exception
38exception
39bool(true)
40bool(true)
41bool(true)
42