[Fix] ArrayIterator::valid was incorrect
Summary:
ArrayIterator::valid was implemented as current() !== false, which would
incorrectly terminate when an element's value was false. Test key() !== null
instead (noting that keys cant be null).
Test Plan:
fast_tests, flib/type/dict
This is just a revert of a bogus change. Adding a new test case to prevent a
repeat.
<?php
function test($a) {
$it = new ArrayIterator($a);
while ($it->valid()) {
var_dump($it->key());
var_dump($it->current());
$it->next();
}
}
test(array('a' => 'x',
false => 'y',
'1' => false,
null => 'z',
'c' => 'w'));
DiffCamp Revision: 144935
Reviewed By: hzhao
CC: hphp-diffs@lists, hzhao
Revert Plan:
OK