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: Closed Type: Bug Package: SPL related PHP Version: Irrelevant Assigned To: laruence Block user comment: N Private report: N New Comment: I really don't think throw an exception is a good idea. Think about this: <?php class foo extends SplFixedArray { public function __construct() { } } $x = new foo; $x->setSize(1); $x[0] = 30; var_dump($x); ?> This works. if you throw an exception when clone. $x->setSize(0) should throw too. since it was not initialized properly. Previous Comments: ------------------------------------------------------------------------ [2012-08-23 15:24:39] larue...@php.net Automatic comment on behalf of laruence Revision: http://git.php.net/?p=php-src.git;a=commit;h=13bcf685cb0a92e502ebe39f4b22c64304a9f333 Log: Fixed bug #62904 (Crash when cloning an object which inherits SplFixedArray) ------------------------------------------------------------------------ [2012-08-23 15:19:16] larue...@php.net 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. ------------------------------------------------------------------------ [2012-08-23 15:18:48] larue...@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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=62904 -- Edit this bug report at https://bugs.php.net/bug.php?id=62904&edit=1