The great confusion with this class is in its naming. ArrayObject infers it will behave as an Array and as an Object. It won't. It behaves as an array. It would better be called ArrayType. You can, with some work, get it to work both as an object and as an array, but that is up to you.

Note that the first argument to ArrayObject::__construct, the initial array, is passed by reference. Nevertheless, modification of the array doesn't modify the object, so it may cause unexpected behaviour.