ID: 38454
User updated by: dtorop933 at gmail dot com
Reported By: dtorop933 at gmail dot com
Status: Open
Bug Type: XML related
Operating System: Linux
PHP Version: 5.1.4
New Comment:
Note that though the reproduce code which I give is not that useful, it
isn't uncommon that one would want a start handler but no end handler
(if one only wanted to grab attributes from start tags, for example).
In that case, it is annoying to see a warning every time the parser
hits a disabled end tag handler.
Previous Comments:
------------------------------------------------------------------------
[2006-08-14 19:28:31] dtorop933 at gmail dot com
Description:
------------
The documentation for xml_set_element_handler says:
"If a handler function is set to an empty string, or FALSE, the handler
in question is disabled."
Unfortunately, I get a PHP Warning if the handler is disabled (rather
than, preferrably, silently skipping the handler).
I have tested this on 5.1.4 and 5.2.0RC2 from CVS.
This may be related to bug #2377?
Reproduce code:
---------------
<?php
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, '', '') or
die("Could not set up element handlers\n");
xml_parse($xml_parser, '<test/>', TRUE) or
die("Could not parse XML\n");
xml_parser_free($xml_parser);
?>
Expected result:
----------------
[NO OUTPUT]
Actual result:
--------------
Warning: xml_parse(): Unable to call handler () in
/tmp/handler_test.php on line 6
Warning: xml_parse(): Unable to call handler () in
/tmp/handler_test.php on line 6
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38454&edit=1