Attached is a patch to make allow disabling element handlers in the xml extension.
The documentation for xml_set_default_handler, xml_set_element_handler, xml_set_external_entity_ref_handler, etc. states "If a handler function is set to an empty string, or FALSE, the handler in question is disabled." This doesn't seem to work cleanly in the current source, instead a warning message is generated. I'm sadly ignorant about writing proper C for PHP, please forgive my any grievous errors in the code. Please also forgive me if I am misunderstanding the documentation and this is a feature which actually shouldn't be present in PHP. I forwarded this patch already to Thies Arntzen who is listed is the extension maintainer, but he says he is not currently working on the PHP project. ---------- Some sample code to replicate this problem is: <? function startElement($parser, $name, $attrs) { print "start element $name\n"; } $parser = xml_parser_create(); xml_set_element_handler($parser, 'startElement', FALSE); xml_parse($parser, "<tag/>", true); xml_parser_free($parser); ?> ---------- With 5.0.2 and current CVS PHP I see: start element TAG Warning: xml_parse(): Unable to call handler () in /home/dtorop/src/comet/dp/scripts/xmlbug.php on line 8 ---------- With the patched code I see: start element TAG
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php