Bug #62904 [Com]: Crash when cloning an object which inherits SplFixedArray
Edit report at https://bugs.php.net/bug.php?id=62904&edit=1
ID: 62904
Comment by: reeze dot xia at gmail dot com
Reported by: felipe@php.net
Summary: Crash when cloning an object which inherits
SplFixedArray
Status: Open
Type: Bug
Package: SPL related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
when construct a object but didn't call the parent constructor.
this patch makes it construct as default.
We could also throw an exception here too, but other method didn't
checked the situation of SplFixArray::__construct didn't get called.
so I think we could makes them consist.
Previous Comments:
------------------------------------------------------------------------
[2012-08-23 12:30:59] felipe@php.net
Description:
------------
See below.
Test script:
---------------
<?php
class foo extends SplFixedArray {
public function __construct() { }
}
$x = new foo;
try {
$z = clone $x;
} catch (Exception $e) {
var_dump($e->getMessage());
}
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0x082fc564 in spl_fixedarray_object_new_ex (class_type=0xb6a06f74, obj=0xbfffbf08, orig=0xb6a05964,
clone_orig=1, tsrm_ls=0x8942050)
at /home/felipe/dev/php-src/ext/spl/spl_fixedarray.c:228
228 spl_fixedarray_init(intern->array, other->array->size TSRMLS_CC);
(gdb) p other->array
$6 = (spl_fixedarray *) 0x0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62904&edit=1
Thread (5 messages)