Skip to content

Commit afea2b2

Browse files
committed
GH-22000 - add test
1 parent 572753f commit afea2b2

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

ext/reflection/tests/gh22000.phpt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
GH-22000 - Ensure __isset is not returning a reference in ReflectionProperty::isReadable()
3+
--FILE--
4+
<?php
5+
class TestClass {
6+
public int $a;
7+
public int $b;
8+
public int $c;
9+
10+
public function __construct() {
11+
unset($this->b);
12+
unset($this->c);
13+
}
14+
15+
public function &__isset($name) {
16+
return $name === 'c';
17+
}
18+
19+
public function __get($name) {}
20+
}
21+
22+
23+
function test($class) {
24+
try {
25+
$rc = new ReflectionClass($class);
26+
foreach ($rc->getProperties() as $rp) {
27+
echo $rp->getName() . ' from global: ';
28+
var_dump($rp->isReadable(null, new $class));
29+
}
30+
} catch(\Exception $ex) {
31+
echo $ex->getMessage();
32+
}
33+
}
34+
35+
test('TestClass');
36+
?>
37+
--EXPECTF--
38+
a from global: bool(false)
39+
b from global: __isset should not return a reference

0 commit comments

Comments
 (0)