#24644 [Com]: Fatal error because of private method
| From: | erik at erikcentral dot net | Date: | Thu, 07 Aug 2003 21:07:55 +0000 |
| Subject: | #24644 [Com]: Fatal error because of private method | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-45529@lists.php.net to get a copy of this message | ||
ID: 24644
Comment by: erik at erikcentral dot net
Reported By: Bertrand dot Willm at laposte dot net
Status: Open
Bug Type: XML related
Operating System: Windows XP
PHP Version: 5.0.0b1 (beta1)
New Comment:
<snip>
function CreateXMLParser() {
$this->parser = xml_parser_create("ISO-8859-1");
$new_ref = $this;
xml_set_object($this->parser, $new_ref);
xml_set_element_handler($this->parser,array($this,"myOpenElement"),array($this,"myCloseElement"));
xml_set_character_data_handler($this->parser,array($this,"myCharData"));
}
<snip>
works on Linux phpV5.0.0b1
Thanks helly@php.net
Previous Comments:
------------------------------------------------------------------------
[2003-07-29 09:12:47] sfox@php.net
Just a note to say I've now tested this with sane data and using
helly@php.net's array. It works fine if you call the base class
directly. I moved the $this->privateFunction() call to the
EndElement() function to check what's happening; when called via the
extended class, the entire thing works except that privateFunction()
throws its (expected) error.
Basically the xml parser handlers are bypassing the ppp checks.
Leaving this bug open as unsure whether this is intended behaviour.
------------------------------------------------------------------------
[2003-07-22 12:52:49] Bertrand dot Willm at laposte dot net
There is not difference with or without the &.
------------------------------------------------------------------------
[2003-07-16 02:54:13] helly@php.net
Not good, but anyway please try without & for $this:
array($this...)
------------------------------------------------------------------------
[2003-07-16 01:15:11] Bertrand dot Willm at laposte dot net
I replace the following line :
xml_set_element_handler($parser, 'StartElement', 'EndElement');
with :
xml_set_element_handler($parser, array(&$this, 'StartElement'),
array(&$this, 'EndElement'));
but PHP crashes.
------------------------------------------------------------------------
[2003-07-14 14:26:41] helly@php.net
The only interesting part here is that the error message should say
that private method StartElement() was called.
The problem is that by the call to xml_parse() the connection to the
instance gets lost. you should use array($this,'<method_name>')
instead. Try that please.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/24644
--
Edit this bug report at http://bugs.php.net/?id=24644&edit=1