ID: 14884
Updated by: cmv
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: DOM XML related
Operating System: Windows 2000
PHP Version: 4.0.6
Old Assigned To: 
Assigned To: cmv
New Comment:

This works fine in 4.1.1 under Linux.  I know there were several bug
fixes in the DOMXML extension between 4.1.0 and 4.1.1.

I'd try upgrading to 4.1.1 first, and see if that solves your
problems.

- Colin

Previous Comments:
------------------------------------------------------------------------

[2002-01-06 03:27:53] [EMAIL PROTECTED]

Environment:
 - Windows 2000 Server (SP2)
 - Apache 1.3.22
 - PHP 4.0.6 (windows binaries from www.php.net) running as CGI

 Here is a small test case: 

test.xml:
=========
<?xml version="1.0"?>
<root>
    <node>
        <child id="1"/>
        <child id="2"/>
        <child id="3"/>
    </node>
</root>

test.php
========
<?php
$xml = xmldoc(join('',file('test.xml')));
$xml->xpath_init();
$ctx = xpath_new_context($xml);
for ($i=0;$i<100;$i++)
{
    echo $i."<br>";
    $nodes = xpath_eval($ctx,'count(//child[@id &lt; '.$i.'])');
};
?>

 As you can see, this code just tries to execute 100 XPath expressions
for the same DOM XML object. And it hangs after ~12 iterations.

 This bug available only on Windows, this test case works well on
Linux.

 It also seems to not work properly in PHP 4.1.0.

 Also this expression seems to be evaluated wrong, because it returns
'false' value instead of number of nodes. Here is small XSLT template,
which generates correct results:

test.xsl
========
<?xml version="1.0"?>

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

<xsl:output method="text"/>

<xsl:template name="loop">
    <xsl:param name="counter">1</xsl:param>
    [<xsl:value-of select="$counter"/> - <xsl:value-of
select="count(//child[@id &lt; $counter])"/>]
    <xsl:if test="$counter &lt; 100">
        <xsl:call-template name="loop"><xsl:with-param name="counter"
select="$counter + 1"/></xsl:call-template>
    </xsl:if>
</xsl:template>

<xsl:template match="/">
    <xsl:call-template name="loop"/>
</xsl:template>

</xsl:stylesheet>



------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=14884&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to