php-src/Zend/tests/foreach_018.phpt
Nikita Popov 7dbdf2db83 Fix foreach object property visibility checks
Again, check_property_access() does not correctly work for properties
that look like mangled private propert names (but aren't). Fix this
by only checking visibility for INDIRECT properties.

foreach currently still unmangles property names, even if they don't
correspond to declared properties. HHVM does not do this (and I think
this is correct.) As this is done consistently, leaving it alone
for now.
2016-11-22 21:01:15 +01:00

21 lines
266 B
PHP

--TEST--
Foreach on stdClass with properties looking like mangled properties
--FILE--
<?php
$obj = (object)[
"\0A\0b" => 42,
"\0*\0c" => 24,
];
foreach ($obj as $k => $v) {
var_dump($k, $v);
}
?>
--EXPECT--
string(1) "b"
int(42)
string(1) "c"
int(24)