php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53858 infinite loop in __tostring() causes seg fault
Submitted: 2011-01-27 19:01 UTC Modified: 2011-02-01 18:43 UTC
From: alok at fb dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.3.5 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alok at fb dot com
New email:
PHP Version: OS:

 

 [2011-01-27 19:01 UTC] alok at fb dot com
Description:
------------
The following piece of code would cause "PHP Fatal error:  [php_fb]: call depth has exceeded the maximum recursion setting of 500!, eject! eject! eject!..." in 5.2.5. However, on versions 5.3.3 and 5.3.5, I am seeing a segmentation fault.


Test script:
---------------
<?php

class A { public function __toString() { (string)$this; } }

(string)new A();


Expected result:
----------------
"PHP Fatal error:  [php_fb]: call depth has exceeded the maximum recursion setting of 500!, eject! eject! eject!..." seems a reasonable result.

Actual result:
--------------
segmentation fault

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-28 10:37 UTC] scottmac@php.net
This is a crash in stock PHP 5.2 too, Our version in APE has a patch that adds 
fb.recursion_max and overrides zend_execute to do the counting.
 [2011-02-01 14:32 UTC] iliaa@php.net
-Status: Open +Status: Bogus
 [2011-02-01 14:32 UTC] iliaa@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


 [2011-02-01 18:43 UTC] alok at fb dot com
scott: was a previous bug filed? Do you have the bug id.

iliaa: a reproducible seg fault not a bug? Sure...
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 13:01:28 2025 UTC