Not calling handlers on property modification

php.internals

Simeon Koptelov

22 years ago
Hello internals, I'm writing extension that substitutes object's read_property and write_property handlers with it's own and I found that such code <?php class A { private $arr = array(); public function addToArr( $element ) { $this->arr[] = $element; } } $a = new A(); $something = new A(); $a->addToArr( $something ); ?> doesn't produce call to read_property or write_property. It seems strange because something like count( $this->arr ) or foreach( $this->arr as $element ) from A does produce call to read_property for "arr". Is it a bug or feature? If it's the expected behaviour, how can I intercept modification of array-type property?
-- Best regards, Simeon mailto:xi@ngs.ru