# Patch for adding elements to ArrayAccess

- Thread: https://externals.io/message/6768
- Original archive: https://news-web.php.net/php.internals/6768
- Started by Simeon Koptelov on 2004-01-03T13:04:45+00:00
- Messages: 4
- 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

---

## #6768 — Simeon Koptelov — 2004-01-03T13:04:45+00:00

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

Hello internals,

Could anyone who can commit to CVS review this patch and commit it if it's OK?
The patch was made for php5-200401021030 snapshot, the file 
zend_object_handlers.c. It fixes the bug that using $a[] = 'Something' where 
$a is instance of ArrayAccess will invoke offsetSet() with empty offset.

---

## #6769 — Derick Rethans — 2004-01-03T13:16:38+00:00

URL: https://externals.io/message/6768#6769 · In reply to: #6768

> Could anyone who can commit to CVS review this patch and commit it if it's OK?
> The patch was made for php5-200401021030 snapshot, the file
> zend_object_handlers.c. It fixes the bug that using $a[] = 'Something' where
> $a is instance of ArrayAccess will invoke offsetSet() with empty offset.

Can you please provide an unified diff (diff -u) against the latest CVS
version?

regards,
Derick

---

## #6771 — Marcus Boerger — 2004-01-03T14:12:36+00:00

URL: https://externals.io/message/6768#6771 · In reply to: #6768

Hello Simeon,

Saturday, January 3, 2004, 2:04:45 PM, you wrote:

> Hello internals,

> Could anyone who can commit to CVS review this patch and commit it if it's OK?
> The patch was made for php5-200401021030 snapshot, the file 
> zend_object_handlers.c. It fixes the bug that using $a[] = 'Something' where
> $a is instance of ArrayAccess will invoke offsetSet() with empty offset.

That's avery bad thing because you check all possible values. And meanwhile
we already decided not to support $a[] with ArrayAccess. If you really want
it then i would sugget that the index/offset passed to offsetSet is NULL.

-- 
Best regards,
 Marcus                            mailto:helly@php.net

---

## #6772 — Andi Gutmans — 2004-01-03T14:35:59+00:00

URL: https://externals.io/message/6768#6772 · In reply to: #6768

I don't think the ArrayAccess interface should work with the $a[] notation.
I think `E_ERROR` is appropriate.

Andi

At 07:04 PM 1/3/2004 +0600, Simeon Koptelov wrote:
>Hello internals,
>
>Could anyone who can commit to CVS review this patch and commit it if it's OK?
>The patch was made for php5-200401021030 snapshot, the file
>zend_object_handlers.c. It fixes the bug that using $a[] = 'Something' where
>$a is instance of ArrayAccess will invoke offsetSet() with empty offset.
