From: nightik at intech dot ru
Operating system: Windows XP/2003
PHP version: 5.0.4
PHP Bug Type: SPL related
Bug description: method offsetSet in class extended from ArrayObject crash PHP
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 bug report at http://bugs.php.net/?id=33136&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33136&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=33136&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=33136&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33136&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33136&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33136&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33136&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33136&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33136&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33136&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=33136&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=33136&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33136&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33136&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33136&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33136&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33136&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33136&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33136&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33136&r=mysqlcfg