|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22004 Overload extension and _call() breaks classes.
Submitted: 2003-02-01 19:33 UTC Modified: 2003-04-14 23:03 UTC
Avg. Score:4.6 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:0 (0.0%)
From: tuupola at appelsiini dot net Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.3.0 OS: Solaris 8
Private report: No CVE-ID: None
 [2003-02-01 19:33 UTC] tuupola at appelsiini dot net
If a class is overloaded and it uses __call() the 
overloaded class cannot return anything from its methods. 
Example code:

class Foo {

    var $bar = 'barvalue';

    function Foo() {

    function getBar() {

    function printBar() {

    function getAny() {

    function __call($method,$params,&$return) {


$f = new Foo();

print '$f->getBar(): ' . $f->getBar() . "\n";
print '$f->printBar(): '; print $f->printBar(); print "\n";
print '$f->bar: ' . $f->bar . "\n";
print '$f->getAny(): ' . $f->getAny() . "\n";

output is:

$f->printBar(): barvalue
$f->bar: barvalue

after removing the function __call() from the class it 
works as expected. Output is then:

$f->getBar(): barvalue
$f->printBar(): barvaluefoo
$f->bar: barvalue
$f->getAny(): Any


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-14 23:03 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

just commited fix that makes this code work.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Sep 28 09:01:24 2023 UTC