ID: 42775
Updated by: [EMAIL PROTECTED]
Reported By: david dot nqd at gmail dot com
-Status: Closed
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: N/A
PHP Version: 5.2.4
New Comment:
closed is for implemented features
Previous Comments:
------------------------------------------------------------------------
[2007-09-29 07:03:26] david dot nqd at gmail dot com
closed
------------------------------------------------------------------------
[2007-09-27 06:29:27] david dot nqd at gmail dot com
I've made a mistake on the actual/expected results. It should be:
Expected result:
----------------
the array: array('abc', 'def')
Actual result:
--------------
// Using ArrayAccess as opposed to AppendableArrayAccess
// which doesn't currently exist
the array: array('' => 'def')
------------------------------------------------------------------------
[2007-09-27 06:26:24] david dot nqd at gmail dot com
Description:
------------
A new interface called 'AppendableArrayAccess' that extends ArrayAccess
(and be implemented by ArrayIterator and ArrayObject). This new
interface is simply a push up of the append() method from ArrayIterator
and ArrayObject.
Reproduce code:
---------------
<?php
class Example implements AppendableArrayAccess {
public $array;
public function __construct () {
$this->array = array();
}
public function offsetGet($offset) {
return $this->array[$offset];
}
public function offsetSet($offset, $value) {
$this->array[$offset] = $value;
}
public function offsetExists($offset) {
return isset($this->array[$offset]);
}
public function offsetUnset($offset) {
unset($this->array[$offset]);
}
}
$x = new Example();
$x[] = "abc";
$x[] = "def";
var_dump($x->array);
?>
Expected result:
----------------
// Using ArrayAccess as opposed to AppendableArrayAccess
// which doesn't currently exist
the array: array('def')
Actual result:
--------------
the array: array('abc', 'def')
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42775&edit=1