PHP 4.0 Bug #6500 Updated: XML - startElementHandler
| From: | Bug Database | Date: | Sun, 03 Sep 2000 10:07:17 +0000 |
| Subject: | PHP 4.0 Bug #6500 Updated: XML - startElementHandler | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-31759@lists.php.net to get a copy of this message | ||
ID: 6500
Updated by: stas
Reported By: mario.staas@free-e-project.org
Status: Feedback
Bug Type: Misbehaving function
Assigned To:
Comments:
1. Don't use &$this syntax. It is decprecated
2. Could you cut down your script as much as possible and post it and the minimal XML reproducing
buggy behaviour?
Previous Comments:
[2000-09-03 06:07:17] stas@php.net
1. Don't use &$this syntax. It is decprecated
2. Could you cut down your script as much as possible and post it and the minimal XML reproducing
buggy behaviour?
----------------------------------------------------------------------------
[2000-09-03 05:58:25] mario.staas@free-e-project.org
Sorry! But the error still exists!
I know the (first) bug in PHP4.0.2 (warnings -> function of startElementHandler not found ....)
and it´s fixed.
The bug I described is a little different. It is not the "startElementHandler" itself.
1. CONSTRUCTOR
function XML_HANDLER() {
$this->O_XML_PARSER = xml_parser_create();
xml_set_object($this->O_XML_PARSER,&$this);
xml_set_element_handler($this->O_XML_PARSER,"Tag_Start","Tag_End");
xml_set_character_data_handler($this->O_XML_PARSER,"CData");
}
2. Parse from file (function)
... some statements
while($L_LINE = fread($L_FP, 4096)) {
$this->O_LINE++;
if(!xml_parse($this->O_XML_PARSER, $L_LINE, feof($L_FP)))
die(sprintf("XML error: %s at line %d in file %s",
xml_error_string(xml_get_error_code($this->O_XML_PARSER)),
xml_get_current_line_number($this->O_XML_PARSER), $A_FILE));
}
fclose($L_FP);
----> var_dump($this->O_DATA);
------------OUTPUT------------> array(0) ----> ERROR!!!!!!!!!!!
3. Tag_Start function
function Tag_Start($A_PARSER, $A_ELE_NAME, $A_ATTRIBS) {
if (!isset($A_ATTRIBS)) return;
while(list($L_KEY, $L_VALUE) = each($A_ATTRIBS)) {
$L_EVAL = $this->O_EVAL .'["ATTRIBUTE"]'
.'["' .strtoupper($L_KEY) .'"]';
eval("$this->O_DATA$L_EVAL = $L_VALUE;");
}
----> var_dump($this->O_DATA);
-----------OUTPUT-----------> array(1) { ["FEP_VARS"]=> array(1) {
["STAT"]=> array(1) { ["TORPEDO"]=> array(1) {
["ATTRIBUTE"]=> array(2) { ["VERSION"]=> string(5) "V0300"
["DATE"]=> int(20000701) } } } } } ----> OK !!!!!!!!!!!
}
This is a very critical bug! Please check it...
----------------------------------------------------------------------------
[2000-09-02 22:43:41] sniper@php.net
Please try latest CVS or snapshot from http://snaps.php.net as
this should be
fixed 2 days ago. Reopen this bug report if problem still exists.
--Jani
----------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6500