Bug #62904 [Opn->Csd]: Crash when cloning an object which inherits SplFixedArray
Edit report at https://bugs.php.net/bug.php?id=62904&edit=1
ID: 62904
Updated by: laruence@php.net
Reported by: felipe@php.net
Summary: Crash when cloning an object which inherits
SplFixedArray
-Status: Open
+Status: Closed
Type: Bug
Package: SPL related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2012-08-23 15:18:48] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=42f91d6ac6e4c359313ddc90b86067ab9be6a80f
Log: Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray)
------------------------------------------------------------------------
[2012-08-23 14:48:04] reeze dot xia at gmail dot com
"but other method didn't check" I mean *did* :)
------------------------------------------------------------------------
[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] 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)