|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #54949 provide interface ReadOnlyArrayAccess
Submitted: 2011-05-29 12:08 UTC Modified: 2018-03-25 12:31 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: giorgio dot liscio at email dot it Assigned:
Status: Suspended Package: SPL related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-05-29 12:08 UTC] giorgio dot liscio at email dot it
hi, what about an interface like this?

interface ReadOnlyArrayAccess
abstract public boolean offsetExists ( mixed $offset )
abstract public mixed offsetGet ( mixed $offset )

interface ArrayAccess extends ReadOnlyArrayAccess
abstract public void offsetSet ( mixed $offset , mixed $value )
abstract public void offsetUnset ( mixed $offset )

it is easier to implement when objects must be immutable

thank you


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-21 17:45 UTC] morrison dot levi at gmail dot com
I completely disagree.  Further, ArrayAccess would not 'extend' 
ReadOnlyArrayAccess.  I would simply implement offsetSet and offsetUnset to do 
nothing then raise a warning or throw an exception (I'd throw the exception, 
 [2018-03-25 12:31 UTC]
-Status: Open +Status: Suspended
 [2018-03-25 12:31 UTC]
Apparently, this feature request is controversial, and as such
would require discussion on the internals@ mailing list, at least,
and maybe the RFC process[1]. For the time being, I'm suspending
this ticket.

[1] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 17:01:33 2024 UTC