From: Bertrand dot Willm at laposte dot net
Operating system: Windows XP
PHP version: 5.0.0b1 (beta1)
PHP Bug Type: XML related
Bug description: Fata error because of private method
Description:
------------
I make a class to parse XML.
The element handler functions are private methods.
I tried to call a private method from the StartElement handler.
There is a fatal error.
This should not be the case as all these functions are declared in the
same class.
In a class, private function should have access to the other private
functions of the class.
Reproduce code:
---------------
class CBaseClass {
var $name;
function Parse() {
$parser = xml_parser_create();
xml_set_object($parser, $this);
xml_set_element_handler($parser, 'StartElement', 'EndElement');
xml_parse($parser, '<xml><node/></xml>', true);
xml_parser_free($parser);
}
private function StartElement() {
$this->PrivateFunction();
}
private function EndElement() {
}
private function PrivateFunction() {
}
}
class CExtClass extends CBaseClass {
}
$ExtObject = new CExtClass();
$ExtObject->Parse();
Expected result:
----------------
no error
Actual result:
--------------
Fatal error: Call to private method cbaseclass::PrivateFunction() from
context 'cextclass' in c:\sitesweb\www\test.php5 on line 14
--
Edit bug report at http://bugs.php.net/?id=24644&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24644&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24644&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=24644&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24644&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24644&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24644&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24644&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24644&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24644&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24644&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24644&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24644&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24644&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24644&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24644&r=gnused