#33136 [Fbk->Opn]: method offsetSet in class extended from ArrayObject crash PHP
| From: | nightik at intech dot ru | Date: | Thu, 26 May 2005 05:48:02 +0000 |
| Subject: | #33136 [Fbk->Opn]: method offsetSet in class extended from ArrayObject crash PHP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-79527@lists.php.net to get a copy of this message | ||
ID: 33136
User updated by: nightik at intech dot ru
Reported By: nightik at intech dot ru
-Status: Feedback
+Status: Open
Bug Type: SPL related
Operating System: Windows XP/2003
PHP Version: 5.0.4
New Comment:
With using latest CVS snapshot (PHP 5.1.0-dev, Build Date May 26 2005
04:16:51) error still remain
Previous Comments:
------------------------------------------------------------------------
[2005-05-26 00:37:57] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2005-05-25 13:39:42] nightik at intech dot ru
Description:
------------
method offsetSet in class extended from ArrayObject crash PHP with
message "PHP has encountered an Access Violation at 018CC7A0"
If method offsetSet not present in Collection class it work fine.
Web-server IIS 5.0 on Windows XP and 6.0 on Windows 2003 Server
Reproduce code:
---------------
class Collection extends ArrayObject
{
private $data;
function __construct()
{
$this->data = array();
parent::__construct( $this->data );
}
function offsetGet( $index )
{
echo "Collection::offsetGet()\n";
return parent::offsetGet( $index );
}
function offsetSet( $index, $value )
{
echo "Collection::offsetSet()\n";
parent::offsetSet( $index, $value );
}
}
echo "\n\nInitiate Obj\n";
$arrayObj = new Collection();
echo "Assign values\n";
$arrayObj[] = "foo";
$arrayObj[] = "bar";
$arrayObj["foo"] = "bar";
echo "Getting values\n";
echo $arrayObj["foo"];
echo "Printing Collection\n";
print_r( $arrayObj );
echo "Count Collection items\n";
echo count( $arrayObj );
Expected result:
----------------
Initiate Obj
Assign values
Collection::offsetSet()
Collection::offsetSet()
Collection::offsetSet()
Getting values
Collection::offsetGet()
bar
Printing Collection
Collection Object
(
[0] => foo
[1] => bar
[foo] => bar
)
Count Collection items
3
Actual result:
--------------
PHP has encountered an Access Violation at 018CC7A0
Initiate Obj
Assign values
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33136&edit=1