Internals Folks--
I'm investigating a problem in WinCache's opcode caching for PHP5x, and I'm baffled.
Could someone please explain the difference between the two following code fragments? Specifically, what is the difference in the HashTable and Bucket entries in C.
/* Assume $values is an empty array, and $defaults is populated via ReflectionClass::getDefaultProperties(), and definitely contains an element 'Banana'=>'some string' */
Fragment 1:
foreach ($defaults as $key => $value) {
$values["${key}"] = $value; /* <--- this line */
}
var_dump(isset($values['Banana']));
Fragment 2:
foreach ($defaults as $key => $value) {
$values[$key] = $value; /* <--- this line */
}
var_dump(isset($values['Banana']));
For scripts cached in WinCache, Fragment 1 works, but Fragment 2 doesn't work. I've single-stepped thru zend_isset_isempty_dim_prop_obj_handler_SPEC_VAR_CONST() in the debugger, both cached and un-cached, and it appears that the Bucket->h value is incorrect in the Fragment 2 case.
WinCache's opcode caching code looks like it can't get this wrong; It should be faithfully copying the Bucket->h value whenever it caches the opcode array.
Any help in understanding the difference in what the Zend Core does with the two fragments would be very helpful!
Thx!
--E.