#22004 [Opn->Csd]: Overload extension and _call() breaks classes.
| From: | shane@php.net | Date: | Tue, 15 Apr 2003 04:03:30 +0000 |
| Subject: | #22004 [Opn->Csd]: Overload extension and _call() breaks classes. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-37687@lists.php.net to get a copy of this message | ||
ID: 22004
Updated by: shane@php.net
Reported By: tuupola at appelsiini dot net
-Status: Open
+Status: Closed
Bug Type: Class/Object related
Operating System: Solaris 8
PHP Version: 4.3.0
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2003-02-01 19:33:35] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22004&edit=1