|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-05-25 13:39 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 05:00:02 2025 UTC |
Here is the backtrace I can see in HEAD. Program received signal SIGSEGV, Segmentation fault. 0x08276943 in zend_call_function (fci=0xbfffc4a0, fci_cache=0xbfffc460) at /usr/src/dev/clean/php-src_head/Zend/zend_execute_API.c:777 777 (*fci->params[i])->refcount++; (gdb) bt #0 0x08276943 in zend_call_function (fci=0xbfffc4a0, fci_cache=0xbfffc460) at /usr/src/dev/clean/php-src_head/Zend/zend_execute_API.c:777 #1 0x08292fe8 in zend_call_method (object_pp=0xbfffc544, obj_ce=0x844e3cc, fn_proxy=0x8448ec4, function_name=0x831bac3 "offsetSet", function_name_len=9, retval_ptr_ptr=0xbfffc52c, param_count=2, arg1=0x0, arg2=0x8453f3c) at /usr/src/dev/clean/php-src_head/Zend/zend_interfaces.c:87 #2 0x08168d88 in spl_array_write_dimension_ex (check_inherited=1, object=0x844df6c, offset=0x0, value=0x8453f3c) at /usr/src/dev/clean/php-src_head/ext/spl/spl_array.c:366 #3 0x08168ebe in spl_array_write_dimension (object=0x844df6c, offset=0x0, value=0x8453f3c) at /usr/src/dev/clean/php-src_head/ext/spl/spl_array.c:400 #4 0x082f640a in zend_assign_to_object (result=0x8451658, object_ptr=0x843ba60, op2=0x8451680, value_op=0x84516b8, Ts=0xbfffc670, opcode=147) at /usr/src/dev/clean/php-src_head/Zend/zend_execute.c:692 #5 0x082e5904 in ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_HANDLER (execute_data=0xbfffcbc0) at zend_vm_execute.h:23687 #6 0x082a7252 in execute (op_array=0x8448de4) at zend_vm_execute.h:78 #7 0x08282449 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/dev/clean/php-src_head/Zend/zend.c:1072 #8 0x0823fe0c in php_execute_script (primary_file=0xbfffeff0) at /usr/src/dev/clean/php-src_head/main/main.c:1662 #9 0x082f88ae in main (argc=2, argv=0xbffff0c4) at /usr/src/dev/clean/php-src_head/sapi/cli/php_cli.c:1031 (gdb) p fci->params[i] $3 = (zval **) 0xbfffc50c (gdb) p *fci->params[i] $4 = (zval *) 0x0