Edit report at https://bugs.php.net/bug.php?id=49664&edit=1
ID: 49664 Updated by: cataphr...@php.net Reported by: patrik dot lermon at gmail dot com Summary: Clone causes Segmentation fault -Status: Not a bug +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: Still present in trunk; reopening. Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2012-12-18 23:53:05] kurt at kurtrose dot com Python handles this kind of recursion fine: class F(object): def __repr__(self): return self.__repr__() >>> repr(F()) File "<stdin>", line 2, in __repr__ File "<stdin>", line 2, in __repr__ ... File "<stdin>", line 2, in __repr__ File "<stdin>", line 2, in __repr__ RuntimeError: maximum recursion depth exceeded No segfault. ------------------------------------------------------------------------ [2009-10-19 15:31:17] patrik dot lermon at gmail dot com I don't agree. Perhaps my knowledge is not detailed enough, but an infinte recursion should: a) run out of memory and die, or b) detect the recursion and die. In both these cases PHP should die in a controlled manner, not segfault. My understanding is that segfault is never ok - that means the code is faulty. ------------------------------------------------------------------------ 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