hhvm
hhvm copied to clipboard
Modifying an array nested in an ArrayObject by reference segfaults
function main()
{
$ao = new ArrayObject();
$ao['foo'] = ['bar' => 'baz'];
$innerArr = &$ao['foo'];
$innerArr[] = 42;
var_dump($ao);
}
main();
Running this with -vEval.Jit=true segfaults.
Also, the outputs of HHVM (without the jit on) and Zend slightly differ. HHVM outputs:
object(ArrayObject)#1 (1) {
["foo"]=>
&array(2) {
["bar"]=>
string(3) "baz"
[0]=>
int(42)
}
}
Zend outputs:
class ArrayObject#4 (1) {
public $foo =>
array(2) {
'bar' =>
string(3) "baz"
[0] =>
int(42)
}
}
Thanks for reporting this. Feel free to submit a PR if you (or someone else reading this) gets to this before we do.
I committed a fix for this locally which should go out with the next push.
many many thanks @swtaarrs my unit tests are almost 100%!