|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2018-08-10 12:13 UTC] cmb@php.net
 
-Status:      Open
+Status:      Feedback
-Assigned To:
+Assigned To: cmb
  [2018-08-10 12:13 UTC] cmb@php.net
  [2018-08-26 17:00 UTC] cmb@php.net
 
-Status: Feedback
+Status: No Feedback
  [2018-08-26 17:00 UTC] cmb@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 16:00:01 2025 UTC | 
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.