hhvm
hhvm copied to clipboard
Nested array assignment into ArrayObjects fails in JIT-ed code
function assign(&$ao, $key1, $key2, $val) {
$ao[$key1][$key2] = $val;
}
function main() {
$ao = new ArrayObject();
assign($ao, 1, 2,3);
if ($ao[1][2] !== 3) {
echo "IT WASN'T SET!\n";
}
var_dump($ao);
}
main();
The output running it normally via the CLI is:
object(AO)#1 (1) {
[1]=>
array(1) {
[2]=>
int(3)
}
}
Running it with hhvm -vEval.Jit=true arrObj.php fails with:
HipHop Notice: Undefined index: 1 in /home/jmarrama/scratch/arrObj.php on line 13
IT WASN'T SET!
object(AO)#1 (1) {
[140736621896576]=>
array(1) {
[2]=>
int(3)
}
}
Thanks for reporting this. Feel free to submit a PR if you (or someone else reading this) gets a chance to take a look at this before we do.
This is already fixed.