Hello,
I just tried to overwrite a method of ArrayObject like this:
class MyArrayObject extends ArrayObject { public function offsetGet($key) { echo "Here I am\n"; return parent::offsetGet($key); } }
$o = new MyArrayObject(); $o['test'] = 'test'; echo $o['test'];
I think this should output the text "Here I am" because I have overwritten the offsetGet method of ArrayObject which is called if I access an array element of this object. But it doesn't. My method is simply ignored.
Then I've written a simple Object which implements the ArrayAccess interface like the ArrayObject object does. And then I have done the same as above but this time I don't extend ArrayObject but my own object. This works. My overwrite method is called
I'm confused. Why can't I overwrite the method in ArrayObject? Is this a bug? Or are the methods of ArrayObject marked as "final"? But even then I must get an "Cannot override final method" error.
Some hints if I misunderstood something? If not I'm going to file a bug report.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php