php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24296 Sablot XSLT gives error 3 when xml file too big
Submitted: 2003-06-23 06:43 UTC Modified: 2003-07-26 18:51 UTC
From: andrew at shh dot fi Assigned: edink (profile)
Status: Closed Package: XSLT related
PHP Version: 4.3.2 OS: win32 and linux
Private report: No CVE-ID: None
 [2003-06-23 06:43 UTC] andrew at shh dot fi
Description:
------------
The setup is an xml document with several external entities including xml files.

Using the standard xslt functions in php the problem begins when the filesize exceed a limit (don't know what the size is unless I start couting all the includes). By choopping out a number of lines from the files the problem is OK.

Its not about structure as this works OK in MsXML plus other packages like XML Spy. The problem is definately with the sablot/expat somewhere.

I am not sure whether its a combination of entities and filesize or just filesize.

What appears to be happening is some kind of cache that chops the end off therefore giving an error 3 which is an no element found error.

Perhaps the problem is with expat? Any ideas?

Reproduce code:
---------------
<?

$xml = "file://".getcwd()."\\index.xml";
$xsl = "file://".getcwd()."\\text.xsl";

//create the processor
$my_xslt = xslt_create();

//process the file and echo the result
$result = xslt_process($my_xslt,$xml,$xsl);

if (!$result) {
	print "Error Number: ".xslt_errno($my_xslt);
	print xslt_error($my_xslt);
}

//free the processor
xslt_free($my_xslt);

print htmlspecialchars($result);


?>

Expected result:
----------------
A load of text ....

Actual result:
--------------
Warning: Sablotron error on line 293: XML parser error 3: no element found in E:\projects\studybuilder\parse.php on line 12
Error Number: 2
XML parser error 3: no element found

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-23 17:51 UTC] iliaa@php.net
Could you at least aproximate the size of the xml file at which the problems begins to occur?
 [2003-06-24 01:25 UTC] andrew at shh dot fi
I found another person who had experienced similar problems on the Gingerall.com site. He had attached an example file. The size is 277034 characters - rather large. This appears to fail. 

However, I have installed the latest Expat Release 1.95.6 update and it seems to have worked - from a command line. The problem will now need to be addressed in the PHP sablot.

Heres the xslt file:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="iso-8859-1" version="1.0" indent="yes"/>
<xsl:param name="login"/>
<xsl:template match="navigation">
	<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>

Heres the xml file1: test.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE navigation [<!ENTITY module1 SYSTEM "test2.xml">]>
<navigation>&module1;</navigation>

And heres part of the external xml file: test2.xml

<?xml version="1.0" encoding="iso-8859-1"?>
<test>
<![CDATA[
textetxtetxt?????? ... 276,946 Bytes ... ]]>
</test>

Well these are examples but in the real work I need to pass a huge xml file with lots of data.

regards
 [2003-06-25 02:17 UTC] andrew at shh dot fi
Problem resolved!!

Upgrade the expat to the latest version and everything works
 [2003-06-26 12:54 UTC] sniper@php.net
Edin, can you update the expat lib in the win32 stuff..?
Andrew, what version did you use?

 [2003-07-14 18:27 UTC] edink@php.net
Which expat version worked for you?
 [2003-07-20 10:40 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-07-20 15:56 UTC] andrew at shh dot fi
Expat 1.95.6
http://sourceforge.net/projects/expat/
 [2003-07-20 15:58 UTC] andrew at shh dot fi
Close this if need be. It works for me now and the same if you run the updat? on Linux.
 [2003-07-20 22:56 UTC] sniper@php.net
Maybe we should upgrade the bundled expat in ext/xml too..

 [2003-07-26 18:51 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

PHP's bundled expat library was upgraded to 1.95.6.
 [2004-04-01 12:42 UTC] hvila at intercom dot org dot br
I?m still getting this problem, using PHP version 4.3.3 (Debian package) - with already have the bundled expat in ext/xml upgraded to 1.95.6, and Expat 1.95.6.

My XML files are being truncated a little bit after 8 KBytes, and this is causing a error "XML parser error 3: no element found at..."
 [2004-04-19 15:31 UTC] bogomil at spisanie dot com
Hi all
I have the same problem with 4.3.3. My XML is small size 34 lines and 50 symbols easch. What is the problem?

Bogomil
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 11:01:30 2024 UTC