Bug #46754 [Com]: Infinite recursion in __toString method causes crash
| From: | mail at willdaniels dot co dot uk | Date: | Wed, 14 Mar 2012 16:38:48 +0000 |
| Subject: | Bug #46754 [Com]: Infinite recursion in __toString method causes crash | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-168458@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=46754&edit=1
ID: 46754
Comment by: mail at willdaniels dot co dot uk
Reported by: kalle@php.net
Summary: Infinite recursion in __toString method causes crash
Status: Not a bug
Type: Bug
Package: Scripting Engine problem
Operating System: *
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
Using 5.3.10 infinite recursion in __toString still causes a segmentation fault.
Are you really saying that it's OK to just leave the possibility for arbitrary PHP scripts to
cause segfaults, potentially taking down a whole webserver process when using PHP as a shared
library?
Maybe a webserver _can_ implement ways to handle such things, but not all do, and infinite recursion
in normal class methods dies more gracefully.
IMHO preventable segfaults are just too serious to ignore in something that is _intended_ to be
usable as a shared library, so I think this is valid a bug.
Previous Comments:
------------------------------------------------------------------------
[2008-12-05 09:31:33] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Infinite recursion crashes, and always has. This should work in PHP 5.3 though, as we don't
generally use stack for recursion anymore.
------------------------------------------------------------------------
[2008-12-05 02:52:59] kalle@php.net
Description:
------------
Same type of crash as reported in #46156, instead of a crash a memory_limit error is expected.
Reproduce code:
---------------
<?php
class Crash
{
public function __toString()
{
return((string) new self);
}
}
echo new Crash;
?>
Expected result:
----------------
memory_limit error
Actual result:
--------------
Crash
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=46754&edit=1