Edit report at https://bugs.php.net/bug.php?id=49664&edit=1
ID: 49664 Comment by: initrd dot gz at gmail dot com Reported by: patrik dot lermon at gmail dot com Summary: Clone causes Segmentation fault Status: Re-Opened Type: Bug Package: Reproducible crash Operating System: Linux PHP Version: 5.*, 6 (2009-09-20) Block user comment: N Private report: N New Comment: C lets you do a lot of stuff you aren't supposed to do. Just because C allows it doesn't mean higher level languages like PHP should. An out of memory error is much more helpful than a segfault, which could come from anything. Also, segfaults have historically lead to exploits. Previous Comments: ------------------------------------------------------------------------ [2013-04-06 17:45:36] dinesh dot joshi at yahoo dot com This segmentation fault / coredump behavior is consistent with what lower level languages like C. So IMHO this should not be considered a PHP bug. Just don't get into infinite recursions. The language can't stop you from doing something stupid. Here's a C program that demos the same behavior: ------------------------------ #include<stdio.h> void fn() { char buff[16*1024]; fn(); } int main(void) { fn(); } ------------------------------ ------------------------------------------------------------------------ [2013-02-23 22:58:49] cataphr...@php.net Still present in trunk; reopening. ------------------------------------------------------------------------ [2013-01-28 13:43:17] cf0hay at gmail dot com Same az OP (with PHP 5.4.8): $ php a.php a before cloning: a: [- >] Segmentation fault ------------------------------------------------------------------------ [2013-01-23 12:07:28] patrik dot lermon at gmail dot com And what do you get when you try with the reproduce code? ------------------------------------------------------------------------ [2013-01-23 11:27:55] cf0hay at gmail dot com > Infinite recursion crashes. There's no fix for that. Err, what? $ php -r 'function a(){ a(); } a();' PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 130968 bytes) in Command line code on line 1 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 130968 bytes) in Command line code on line 1 This is the intended behaviour on infinite recursion, not a segmentation fault. I wouldn't be surprised this could lead a security problem rather just a simple crash. ------------------------------------------------------------------------ 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=49664 -- Edit this bug report at https://bugs.php.net/bug.php?id=49664&edit=1