hhvm icon indicating copy to clipboard operation
hhvm copied to clipboard

Nested array assignment into ArrayObjects fails in JIT-ed code

Open jmarrama opened this issue 12 years ago • 2 comments

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)
    }
  }

jmarrama avatar Feb 25 '14 02:02 jmarrama

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.

scannell avatar Feb 25 '14 03:02 scannell

This is already fixed.

LiraNuna avatar Apr 15 '14 18:04 LiraNuna