Bug #71595 [Com]: NS end handler is never called

From: Date: Tue, 16 Feb 2016 17:59:23 +0000
Subject: Bug #71595 [Com]: NS end handler is never called
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199270@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71595&edit=1 ID: 71595 Comment by: anrdaemon at freemail dot ru Reported by: anrdaemon at freemail dot ru Summary: NS end handler is never called Status: Analyzed Type: Bug Package: XML related Operating System: Windows PHP Version: 5.6.18 Block user comment: N Private report: N New Comment: Do you think it deserves at least a note in documentation? You know, it is rather frustrating to write a parser and find out that it just not supposed to work as documented. Previous Comments: ------------------------------------------------------------------------ [2016-02-16 16:08:02] ab@php.net Thanks for the reports. How it looks like, the things you've realized do happen most likely not due to a PHP bug, but depend on the libxml2 usage. libxml doesn't support all the available callbacks, and it's documented. From a quick look, have to check deeper, the other tickets you've reported have the same cause. Many Linux distros link with libxml, as well it's used on Windows. Thanks. ------------------------------------------------------------------------ [2016-02-15 02:38:31] anrdaemon at freemail dot ru Description: ------------ When NS-aware parser is created, the handler set by xml_set_end_namespace_decl_handler() is never called. Test script: --------------- <?php $indent = ''; $parser = xml_parser_create_ns('UTF-8'); xml_set_end_namespace_decl_handler($parser, function($self, $name) { global $indent; $ns = $name ?: '(default)'; print $indent . "/NS:{$ns}\n"; }); // Expecting at least one mention of /NS: ... xml_parse($parser, '<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE shape PUBLIC "-//Dia//DTD Dia shape 1.0//EN" "http://www.daa.com.au/~james/dia-shape-ns"> <shape> <svg xmlns:svg="http://www.w3.org/2000/svg" svg:width="300px" svg:height="300px" svg:viewBox="0 0 3 3"> <svg:circle svg:style="fill: yellow;" cx="1.5" cy="1.5" r="0.5"/> </svg> </shape>', true); print xml_error_string(xml_get_error_code($parser)) . "\n"; ?> Expected result: ---------------- Expecting at least one mention of "/NS:...". Especially one, where parser leaving the enclosed SVG structure. Actual result: -------------- No error (No really, there's no error. But... Where's my handlers?) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71595&edit=1

« previous php.bugs (#199270) next »