php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: giorgio dot liscio at email dot it
New email:
PHP Version: OS:

 

 [2011-05-29 12:08 UTC] giorgio dot liscio at email dot it
Description:
------------
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


Patches

Pull Requests

History

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, 
myself).
 [2018-03-25 12:31 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2018-03-25 12:31 UTC] cmb@php.net
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] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 19:01:28 2025 UTC