Skip to content

Commit df2c656

Browse files
committed
new test
1 parent 23bf3c9 commit df2c656

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

ext/reflection/tests/bug40794.phpt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
--TEST--
2+
Bug #40794 (ReflectionObject::getValues() may crash when used with dynamic properties)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded("reflection")) {
6+
die("skip");
7+
}
8+
?>
9+
--FILE--
10+
<?php
11+
12+
$obj = new stdClass();
13+
$obj->prop1 = '1';
14+
$obj->prop2 = '2';
15+
$obj->prop3 = '3';
16+
17+
$reflect = new ReflectionObject($obj);
18+
19+
$array = array();
20+
foreach($reflect->getProperties() as $prop)
21+
{
22+
$array[$prop->getName()] = $prop->getValue($obj);
23+
}
24+
25+
var_dump($array);
26+
27+
echo "Done\n";
28+
?>
29+
--EXPECTF--
30+
array(3) {
31+
["prop1"]=>
32+
string(1) "1"
33+
["prop2"]=>
34+
string(1) "2"
35+
["prop3"]=>
36+
string(1) "3"
37+
}
38+
Done
39+
--UEXPECTF--
40+
array(3) {
41+
[u"prop1"]=>
42+
unicode(1) "1"
43+
[u"prop2"]=>
44+
unicode(1) "2"
45+
[u"prop3"]=>
46+
unicode(1) "3"
47+
}
48+
Done

0 commit comments

Comments
 (0)