xref: /PHP-8.3/ext/reflection/tests/bug40794.phpt (revision f8d79582)
1--TEST--
2Bug #40794 (ReflectionObject::getValues() may crash when used with dynamic properties)
3--FILE--
4<?php
5
6$obj = new stdClass();
7$obj->prop1 = '1';
8$obj->prop2 = '2';
9$obj->prop3 = '3';
10
11$reflect = new ReflectionObject($obj);
12
13$array = array();
14foreach($reflect->getProperties() as $prop)
15{
16    $array[$prop->getName()] = $prop->getValue($obj);
17}
18
19var_dump($array);
20
21echo "Done\n";
22?>
23--EXPECT--
24array(3) {
25  ["prop1"]=>
26  string(1) "1"
27  ["prop2"]=>
28  string(1) "2"
29  ["prop3"]=>
30  string(1) "3"
31}
32Done
33