Hi,
I notice a strange behavior in PHP4 and wonder if anyone can explain it.
Essentially, when I extend a class from a built-in module, I can add and
access variables but can not access new functions I create within the
extended class.
This has only happened attempting to extend classes from ming, but I suspect
it may be a universal problem (?).
That is:
<?PHP
class foo {
}
class bar extends foo {
function bar() {
print "bar";
}
}
$bar = new bar();
$bar->bar(); //PRINTS "bar"
?>
Works as expected, however, in:
<?PHP
class foo extends SWFSprite {
var $x = 10;
function bar() {
print "bar";
}
}
?>
running:
<?PHP
$foo = new foo();
print $foo->x; //WORKS; PRINTS "10"
$foo->bar(); //RETURNS "Undefined Function" FATAL ERROR
?>
Can anyone explain this behavior? Will it be fixed in PHP5? Is it related to
the Zend engine? Any workarounds?
Many thanks in advance.
Best,
Robert
--
Robert Peake | Peake Professional Consulting
Robert@PeakePro.com | http://www.peakepro.com/