Refactor ArrayIterator::getSingleResult()
Support null offsets in ArrayIterator::offsetSet()

This is necessary for supporting with [] operator to append elements.
Fix ArrayIterator::valid() behavior if element values are false

Check key()'s return value instead, since it will not be confused for a legitimate array key.
Unit tests for ArrayIterator