PHP :: Bug #22004 :: Overload extension and _call() breaks classes.
- ️Sat Feb 01 2003
Bug #22004 | Overload extension and _call() breaks classes. | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Submitted: | 2003-02-01 19:33 UTC | Modified: | 2003-04-14 23:03 UTC |
|
||||||||||
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: <?php class Foo { var $bar = 'barvalue'; function Foo() { } function getBar() { return($this->bar); } function printBar() { print($this->bar); return('foo'); } function getAny() { return('Any'); } function __call($method,$params,&$return) { $return=$method($params[0]); return(true); } } overload('Foo'); $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->getBar(): $f->printBar(): barvalue $f->bar: barvalue $f->getAny(): 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commitsRelated reports
[2003-04-14 23:03 UTC] shane@php.net
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 http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net 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.