ID:               31821
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jsmestad at advantageline dot com
 Status:           Closed
 Bug Type:         *XML functions
 Operating System: Windows XP Professional SP2
 PHP Version:      5CVS-2005-02-02 (dev)
 New Comment:

Fixed by: "Entity errors are reported at the end of the data thus only
if is_final is set and TRUE."


Previous Comments:
------------------------------------------------------------------------

[2005-02-13 22:30:00] [EMAIL PROTECTED]

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.



------------------------------------------------------------------------

[2005-02-07 21:43:16] jsmestad at advantageline dot com

As stated, I believe this to be a documentation problem.

------------------------------------------------------------------------

[2005-02-04 15:18:33] jsmestad at advantageline dot com

The documentation does not make the behavior of the parser obvious. It
states this:

"
When the XML document is parsed, the handlers for the configured events
are called as many times as necessary, after which this function returns
TRUE or FALSE. 

TRUE is returned if the parse was successful, FALSE if it was not
successful, or if parser does not refer to a valid parser. For
unsuccessful parses, error information can be retrieved with
xml_get_error_code(), xml_error_string(),
xml_get_current_line_number(), xml_get_current_column_number() and
xml_get_current_byte_index(). 
"

For that string of XML, the parse was unsuccessful, and yet that
particular call to xml_parse returns true. This behavior is contrary to
the documentation. It states, and I repeat, "TRUE is returned if the
parse was successful, FALSE if it was not successful, or if parser does
not refer to a valid parser." Yet, true is returned also if the parse is
unsuccessful and not specified as complete by the is_final flag.

------------------------------------------------------------------------

[2005-02-04 14:21:33] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

you need to set is_final flag for the error to appear when using libxml
rather than expat so that libxml knows that all the data has been passed
to the parser:
xml_parse($xml_parser,"<thdoc><this>this&that</this><that>thatdata</that></thdoc>",
TRUE);

------------------------------------------------------------------------

[2005-02-02 22:20:59] jsmestad at advantageline dot com

Description:
------------
The XML parser does not return an error when expected.

Reproduce code:
---------------
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "cdata");
$data =
xml_parse($xml_parser,"<thdoc><this>this&that</this><that>thatdata</that></thdoc>");
printf("%s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser));


Expected result:
----------------
not well-formed (invalid token) at line 1

Actual result:
--------------
No error at line 1


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31821&edit=1

Reply via email to