From:             [EMAIL PROTECTED]
Operating system: Solaris 8
PHP version:      4.3.0
PHP Bug Type:     Class/Object related
Bug description:  Overload extension and _call() breaks classes.

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 bug report at http://bugs.php.net/?id=22004&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22004&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22004&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22004&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22004&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22004&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22004&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22004&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22004&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22004&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22004&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22004&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22004&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22004&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22004&r=gnused

Reply via email to