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:        fel...@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:

"but other method didn't check"  I mean *did* :)


Previous Comments:
------------------------------------------------------------------------
[2012-08-23 14:46:29] reeze dot xia at gmail dot com

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.

------------------------------------------------------------------------
[2012-08-23 12:30:59] fel...@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

Reply via email to