# Not calling handlers on property modification

- Thread: https://externals.io/message/6331
- Original archive: https://news-web.php.net/php.internals/6331
- Started by Simeon Koptelov on 2003-12-10T04:21:49+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #6331 — Simeon Koptelov — 2003-12-10T04:21:49+00:00

URL: https://externals.io/message/6331#6331

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
