Bug #70556 [Opn->Fbk]: The parser reports duplicate id's when there are none.

From: Date: Fri, 10 Aug 2018 12:13:52 +0000
Subject: Bug #70556 [Opn->Fbk]: The parser reports duplicate id's when there are none.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216709@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70556&edit=1 ID: 70556 Updated by: cmb@php.net Reported by: chauvaux at crestec dot co dot jp Summary: The parser reports duplicate id's when there are none. -Status: Open +Status: Feedback Type: Bug Package: DOM XML related Operating System: Windows 2008 PHP Version: 5.5.29 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: While I can reproduce this with PHP 5.6.15 with libxml 2.9.2, I can't with PHP 7.0.18 with libxml 2.9.4 nor with recent master and libxml 2.9.8 (all Windows 10). Since active support for PHP 5 ended long ago, it seems this ticket can be closed, unless somebody else can reproduce it with any actively supported PHP version[1]. [1] <http://php.net/supported-versions.php> Previous Comments: ------------------------------------------------------------------------ [2015-09-23 05:27:17] chauvaux at crestec dot co dot jp Description: ------------ Bug report PHP: versions 5.5.24 and up (working as an Apache module on a window box, and installed with XAMPP) Module: XML DOM Method: load() We are handling large XML documents (books). To make things easier to read, we use a main XML document with the doctype header and a list of entity declarations (one per chapter). The main XML document body is just a list of entity references. Then we have separate files for each chapter. Problem: when trying to load the main file, the parser reports duplicate id values. It seems that the parser registers the values of the id attribute at the time it reads the entity declaration, and again when it actually imports the contents of the entity file. NOTE: this problem did not occurred with version up to 5.5.23. It started at version 5.5.24 and is still there at version 5.5.29. To make things easier to whoever will be kind enough to try to fix this bug, we have prepared 3 small files: domtest.xml is the main file that we want to load in to the DOM object. file_01.xml is the contents of one chapter. domload.php is a small script that will allow you to replicate the error. Thank you very much for your help. Test script: --------------- /////////////////////////////////////////////// Filename: domtest.xml: the main XML file to load <?xml version='1.0' encoding='UTF-8'?> <!--simple dtd for the purpose of this test--> <!DOCTYPE book [ <!ELEMENT book (chapter)+ > <!ELEMENT chapter (para)* > <!ELEMENT para EMPTY > <!ATTLIST para id ID #REQUIRED > <!--entity declaration for one chapter; a real book would contain many of them--> <!ENTITY file_01 SYSTEM "file_01.xml"> ]> <book> <!--entity reference; a real book would contain many of them--> &file_01; </book> ////////////////////////////////////////////// Filename: file_01.xml: <chapter> <para id='id_010'>aaa</para> <para id='id_011'>bbb</para> <para>ccc</para> </chapter> ///////////////////////////////////////////// domload.php <?php $dom = new DOMDocument(); $dom->resolveExternals = true; $dom->substituteEntities = true; $result = $dom->load('domtest.xml'); var_dump($result); $dom->save('saved.xml'); ?> Expected result: ---------------- Since no id is replicated, a warning should not appear. Actual result: -------------- A warning telling that there are duplicate id's. The file however loads correctly. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70556&edit=1

« previous php.bugs (#216709) next »