php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23128 PHP crashes when using <xsl:sort> in some cases
Submitted: 2003-04-09 06:55 UTC Modified: 2003-04-28 09:48 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: ed at avi dot ru Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 4.3.2RC1 OS: Windows 98
Private report: No CVE-ID: None
 [2003-04-09 06:55 UTC] ed at avi dot ru
The realisation of sorting seems to be buggy in xslt extension. Let's suppose that we have the following xml:

<?xml version="1.0"?>
<root>
  <node id="1"></node>
  <node id="4"></node>
  <node id="2"></node>
  <node id="3"></node>
</root>

We're processing these data via xslt_process(). Here's the part of xsl file:

...
<xsl:template match="/root">
  <xsl:for-each select="node">
    <xsl:sort select="@id" data-type="number" />
    ...
  </xsl:for-each>
</xsl:template>
...

It works ok. But if we remove data-type attribute from <xsl:sort> tag or change it to "text", the PHP crashes.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-10 09:35 UTC] ed at avi dot ru
The problem remains. ??? php doesn't crash now, but seems to hang or something like this. The page doesn't load, and the system becomes overloaded until the Apache process is killed (PHP runs as ISAPI module).
 [2003-04-23 03:59 UTC] sniper@php.net
Please provide a short and self-contained example which
causes the crash.

 [2003-04-23 06:31 UTC] ed at avi dot ru
XML file (test.xml):

<?xml version="1.0"?>
<root>
  <node id="3" />
  <node id="1" />
  <node id="2" />
  <node id="4" />
</root>

XSL-template (test.xsl):

<?xml version="1.0"?>
<xsl:stylesheet
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0">

<xsl:template match="/root">
	<xsl:for-each select="node">
		<xsl:sort select="@id" data-type="text" />
		<xsl:value-of select="@id" />
	</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

PHP script which causes the crash:

<?PHP

	$xslt = xslt_create ();

	xslt_set_base ($xslt, sprintf ('file://%s/', dirname ($_SERVER['SCRIPT_FILENAME'])));
	print (xslt_process ($xslt, 'test.xml', 'test.xsl'));

	xslt_free ($xslt);

?>
 [2003-04-26 13:46 UTC] msopacua@php.net
Are you able to reproduce this with the sabcmd utility that comes with Sablotron?
 [2003-04-28 07:50 UTC] ed at avi dot ru
Yes, the crush was reprodused width sabcmd utility.
 [2003-04-28 09:48 UTC] sniper@php.net
Not PHP bug then.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 19:01:33 2024 UTC