php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62989 recursive __call cause segfault
Submitted: 2012-09-01 12:42 UTC Modified: 2012-09-01 14:45 UTC
From: gmblar+php at gmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.4.6 OS: MacOSX
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
41 - 7 = ?
Subscribe to this entry?

 
 [2012-09-01 12:42 UTC] gmblar+php at gmail dot com
Description:
------------
recursive __call cause segfault

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

class foo {
    public function __call($method, $arguments) {
        $this->bar();
    }
}

$foo = new foo();
$foo->bar();


Expected result:
----------------
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to 
allocate 130968 bytes) in - on line 6


Actual result:
--------------
Segmentation fault: 11


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-01 14:45 UTC] felipe@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

It's expected, due the call stack overflow.
 [2012-09-01 14:45 UTC] felipe@php.net
-Status: Open +Status: Not a bug
 [2012-09-01 15:21 UTC] gmblar+php at gmail dot com
I expect the same from __call as from a normal method which abort with a fatal 
error.

<?php

class foo {
    public function bar() {
        $this->bar();
    }
}

$foo = new foo();
$foo->bar();

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to 
allocate 130968 bytes) in - on line 5
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC