php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18457 Crash with XPath
Submitted: 2002-07-21 12:52 UTC Modified: 2002-08-05 05:34 UTC
From: kelcon at ceti dot pl Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.2.1 OS: Win98
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: kelcon at ceti dot pl
New email:
PHP Version: OS:

 

 [2002-07-21 12:52 UTC] kelcon at ceti dot pl
This code crashesh php (tested via php-cli). When $i less-then condition is set to 100, this code works, but when is greater, it crashes on exit.

$content = '<?xml version="1.0" encoding="utf-8"?>

<auth xmlns:dt="http://www.nowhere.pl/">

  <dt:shadow name="rules" desc="Rules" zygryf="label"/>  
  <rules>

    <dt:shadow name="rule" desc="Rule" multiple="1" required="0"/>
    <rule>

      <dt:shadow name="expr" zygryf="text" desc="Match Expression" zygryf-size="40"/>
      <expr/>

      <dt:shadow name="group" desc="Group" multiple="1" required="0"/>
      <group>

        <dt:shadow name="name" zygryf="text" desc="Name" zygryf-size="20"/>
        <name/>
        <dt:shadow name="read" zygryf="bool" desc="Read"/>
        <read/>
        <dt:shadow name="write" zygryf="bool" desc="Write"/>
        <write/>
  
      </group>
    </rule>
  </rules>

  <dt:shadow name="default" desc="Default Rule" zygryf="label"/>  
  <default>

    <dt:shadow name="group" desc="Group" multiple="1" required="0"/>
    <group>

      <dt:shadow name="name" zygryf="text" desc="Name" zygryf-size="20"/>
      <name/>
      <dt:shadow name="read" zygryf="bool" desc="Read"/>
      <read/>
      <dt:shadow name="write" zygryf="bool" desc="Write"/>
      <write/>

    </group>

  </default>

</auth>

';

print microtime() . "\n";

$dom = domxml_open_mem($content);

for ($i = 0; $i < 300; $i++) {
  $dom = domxml_open_mem($content);
  $context = xpath_new_context ($dom);
  $results = xpath_eval_expression($context,"//*[name() = 'dt:shadow'][@zygryf='text']");
  unset($dom);
  unset($context);
  unset($results);
  }

print microtime() . "\n";

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-05 05:34 UTC] chregu@php.net
This bug should be fixed in HEAD and PHP_4_2_0 (stable) branch

get it from
http://snaps.php.net/win32/

chregu
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC