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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gmblar+php at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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 May 16 05:01:35 2024 UTC