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:        [email protected]
 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] [email protected]

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] [email protected]

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

Reply via email to