Edit report at https://bugs.php.net/bug.php?id=46754&edit=1

 ID:                 46754
 Updated by:         ras...@php.net
 Reported by:        ka...@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:

No, it isn't ok which is why it is fixed in PHP 5.3 which was released 3 years 
ago.


Previous Comments:
------------------------------------------------------------------------
[2012-03-14 16:38:48] mail at willdaniels dot co dot uk

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.

------------------------------------------------------------------------
[2008-12-05 09:31:33] der...@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] ka...@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

Reply via email to