xref: /PHP-7.4/Zend/tests/bug50810.phpt (revision ca652aaf)
1--TEST--
2Bug #50810 (property_exists does not work for private)
3--FILE--
4<?php
5
6class ExampleSuperClass
7{
8    private $foo;
9    static protected $bar;
10
11    private function foo()
12    {
13    }
14
15    public function propertyFooExists()
16    {
17        return property_exists($this, 'foo');
18    }
19
20}
21
22class ExampleSubClass extends ExampleSuperClass
23{
24    public function methodExists()
25    {
26        return method_exists($this, 'foo');
27    }
28
29    public function propertyBarExists()
30    {
31        return property_exists($this, 'bar');
32    }
33}
34
35$example = new ExampleSubClass();
36var_dump($example->methodExists());
37var_dump(method_exists($example, 'propertyFooExists'));
38var_dump($example->propertyFooExists());
39var_dump($example->propertyBarExists());
40
41?>
42--EXPECT--
43bool(true)
44bool(true)
45bool(true)
46bool(true)
47