# Segfault on ArrayAccess use

- Thread: https://externals.io/message/6621
- Original archive: https://news-web.php.net/php.internals/6621
- Started by Simeon Koptelov on 2003-12-19T18:37:38+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

---

## #6621 — Simeon Koptelov — 2003-12-19T18:37:38+00:00

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

Hello internals,

The following code produces segfault using snapshot php5-200312191230.

<?php

class A implements ArrayAccess
{
    private $array = array();

    public function offsetExists( $offset )
    {
        return isset( $this->array[ $offset ] );
    }
    
    public function offsetGet( $offset )
    {
        return $this->array[ $offset ];
    }

    public function offsetSet( $offset, $data )
    {
        $this->array[ $offset ] = $data;
    }
    
    public function offsetUnset( $offset )
    {
        unset( $this->array[ $offset ] );
    }
}

$arr = new A();
$arr[] = 'Segfault here!';

?>  

Also when trying to do something like `array_keys()` on ArrayAccess
instance, error message is thrown. Will array functions support
ArrayAccess?
  

-- 
Best regards,
 Simeon                          mailto:xi@ngs.ru
