php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32712 loadXML exits with "Extra content at the end of the document"
Submitted: 2005-04-15 09:23 UTC Modified: 2005-04-23 01:00 UTC
Votes:27
Avg. Score:4.4 ± 0.9
Reproduced:24 of 24 (100.0%)
Same Version:4 (16.7%)
Same OS:4 (16.7%)
From: bmuller at milchstrasse dot de Assigned:
Status: No Feedback Package: DOM XML related
PHP Version: 5.0.4 OS: RedHat Linux 2.4.21-4.EL
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bmuller at milchstrasse dot de
New email:
PHP Version: OS:

 

 [2005-04-15 09:23 UTC] bmuller at milchstrasse dot de
Description:
------------
We develop a contentsystem to access Adobe InCopy Documents out of a Primebase Database.  To read and parse the AIC (Adobe InCopy Document Format) we use the DOM XML extension.  UNfortunatly after reading the CLOB/BLOB out of the database an loading it via DOM XML ($dom->loadXML($string), PHP throws the warning "Extra content at the end of the document".  Not all the time, but irreguarly.  If I read the the BLOB, write it in a temp textfile and then read it via $dom->load($filename), everything works fine.  I have checked several times, the data out of the database is _always_ the same amd the XML is wellformed. Is there a memory leak in the loadXML method? 

Reproduce code:
---------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<aic:document xmlns:aic="http://ns.adobe.com/AdobeInCopy/2.0/" name="Hier steht eine Bildunterschrift f?r Bildbreite 65" ver="3.0">

<aic:story xml:space="preserve" track="0" dFont="Times" optalign="0" optsize="40280000 0"><aic:pstyle name="B_BU"/><aic:cstyle name="[No character style]"/>NEU!!!! Hier steht eine Bildunterschrift f?r Bildbreite 65,5</aic:story>
</aic:document>

[...]
primebase_cursor_bind($result, 0,PRIMEBASE_BLOB);
    while ($line = primebase_fetch_array($result)) {
    	$aicdocument = primebase_read_blob($line[content]);

    	$dom = new DOMDocument;
  		$dom->loadXML($aicdocument); }
echo htmlspecialchars(utf8_decode($dom->saveXML()));
[...]

Expected result:
----------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<aic:document xmlns:aic="http://ns.adobe.com/AdobeInCopy/2.0/" name="Hier steht eine Bildunterschrift f?r Bildbreite 65" ver="3.0">

<aic:story xml:space="preserve" track="0" dFont="Times" optalign="0" optsize="40280000 0"><aic:pstyle name="B_BU"/><aic:cstyle name="[No character style]"/>NEU!!!! Hier steht eine Bildunterschrift f?r Bildbreite 65,5</aic:story>
</aic:document>



Actual result:
--------------
Warning:  DOMDocument::loadXML() [function.loadXML]: Extra content at the end of the document in Entity, line: 6 in /usr/local/dreams/htdocs/k4_table_info.php on line 34
<?xml version="1.0"?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-15 14:16 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-04-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-05-11 03:29 UTC] mrc at linuxplatform dot org
For a temp solution, run strval() on your XML buffer.
 [2005-05-16 01:20 UTC] bruno dot baketaric at wob dot ag
running strval() does not work - at least in PHP 4.3.11
 [2007-07-24 17:28 UTC] asd at as dot com dot br
eita n?is
 [2009-06-12 19:27 UTC] connect at gloominc dot org
run mysql command line

mysql> alter database YOURDATABASE default character set utf8;

fixed.

gloominc
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 22:01:28 2024 UTC