Bug #71594 [Com]: NS handler is never called for default namespace defined in DOCTYPE

From: Date: Tue, 03 Apr 2018 09:18:01 +0000
Subject: Bug #71594 [Com]: NS handler is never called for default namespace defined in DOCTYPE
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214574@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71594&edit=1 ID: 71594 Comment by: anrdaemon at freemail dot ru Reported by: anrdaemon at freemail dot ru Summary: NS handler is never called for default namespace defined in DOCTYPE Status: Not a bug Type: Bug Package: XML related Operating System: Windows PHP Version: 5.6.18 Assigned To: cmb Block user comment: N Private report: N New Comment: Under that light, appears to be so. Previous Comments: ------------------------------------------------------------------------ [2018-04-02 20:54:34] cmb@php.net > In other words, it does not process doctype declaration. To my knowledge, a doctype declaration is not a namespace declaration, nor could it contain one. It seems to me that bug #71593 is not necessarily related to this issue. ------------------------------------------------------------------------ [2018-04-02 19:20:03] anrdaemon at freemail dot ru In other words, it does not process doctype declaration. Got it, thanks. ------------------------------------------------------------------------ [2018-04-02 12:53:14] cmb@php.net > Expecting the notion of NS:(default) when the root tag is > processed. Why? In the given XML there is no default namespace declaration, opposed to something like: <foo xmlns="http://example.com"/> So, in my opinion, this is not a bug. ------------------------------------------------------------------------ [2016-02-15 02:25:12] anrdaemon at freemail dot ru Description: ------------ When NS-aware parser is created, the handler set by xml_set_start_namespace_decl_handler() is never called for default namespace given in the DOCTYPE attribute, when the root tag is processed. See also https://bugs.php.net/bug.php?id=71593 Test script: --------------- <?php $indent = ''; $parser = xml_parser_create_ns('UTF-8'); xml_set_start_namespace_decl_handler($parser, function($self, $name, $target) { global $indent; $ns = $name ?: '(default)'; print $indent . "NS:{$ns} {$target}\n"; }); // Expecting the notion of NS:(default) when the root tag is processed. 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 xmlns:svg="http://www.w3.org/2000/svg"> <name>Custom - Styles mix</name> </shape>', true); print xml_error_string(xml_get_error_code($parser)) . "\n"; ?> Expected result: ---------------- NS:(default) http://www.daa.com.au/~james/dia-shape-ns NS:svg http://www.w3.org/2000/svg No error I.e. NS(default) should be printed when root tag is processed (before root element handler is called). Actual result: -------------- NS:svg http://www.w3.org/2000/svg No error ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71594&edit=1

« previous php.bugs (#214574) next »