#38454 [Opn->Fbk]: warning upon disabling handler via xml_set_element_handler
| From: | tony2001@php.net | Date: | Mon, 14 Aug 2006 19:41:05 +0000 |
| Subject: | #38454 [Opn->Fbk]: warning upon disabling handler via xml_set_element_handler | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-100787@lists.php.net to get a copy of this message | ||
ID: 38454
Updated by: tony2001@php.net
Reported By: dtorop933 at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: XML related
Operating System: Linux
PHP Version: 5.1.4
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2006-08-14 19:37:55] dtorop933 at gmail dot com
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.
------------------------------------------------------------------------
[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