php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19081 crashes when doing lots of get_elements_by_tagname
Submitted: 2002-08-24 04:38 UTC Modified: 2002-08-27 17:29 UTC
From: KingGeoffrey at yahoo dot com Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.2.2 OS: WinNT
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: KingGeoffrey at yahoo dot com
New email:
PHP Version: OS:

 

 [2002-08-24 04:38 UTC] KingGeoffrey at yahoo dot com
The exact cause of the bug is not clear to me, i have pruned my code down to something that reliably causes it both in cli and web server version.

To reproduce (i hope) put .php and .xml files in same and execute in cli mode, it should crash as it completes.

Dr watson writes a dump file i can retrieve that if requested.

I am running unmodified win binaries 4.2.2 as distributed.

The two files are...
--- crash.php ---
<?php

function findNode($Doc, $TagName, $AttrName, $AttrValue) {
	$nodes = $Doc->get_elements_by_tagname($TagName);
	reset($nodes);
	while (list($key, $value) = each($nodes)) {
		if ($AttrValue == $value->get_attribute($AttrName))
			return $value;
	}
	return null;
}

function save($XmlFile, $Username, $GameId) {
	!$doc = domxml_open_file($XmlFile);
	$user = findNode($doc, 'user', 'username', $Username);
	echo ">";
	if ($user)
		$games = $user->child_nodes();
	echo "<";
}
echo "php:" . phpversion() . " domxml:" . domxml_version() . "<br />\n";
for($i=0; $i < 40; $i++) {
	save("crash.xml", "abc", "x");
}
?>
--- crash.xml ---
<?xml version="1.0" encoding="UTF-8"?>
<users>
  <user username="abc">
    <game id="game0"/>
    <game id="game1"/>
    <game id="game2"/>
    <game id="game3"/>
    <game id="game4"/>
    <game id="game5"/>
    <game id="game6"/>
    <game id="game7"/>
    <game id="game8"/>
    <game id="game9"/>
    <game id="game10"/>
    <game id="game11"/>
    <game id="game12"/>
    <game id="game13"/>
    <game id="game14"/>
    <game id="game15"/>
    <game id="game16"/>
    <game id="game17"/>
    <game id="game18"/>
    <game id="game19"/>
    <game id="game20"/>
    <game id="game21"/>
    <game id="game22"/>
    <game id="game23"/>
    <game id="game24"/>
    <game id="game25"/>
    <game id="game26"/>
    <game id="game27"/>
    <game id="game28"/>
    <game id="game29"/>
    <game id="game30"/>
    <game id="game31"/>
    <game id="game32"/>
    <game id="game33"/>
    <game id="game34"/>
    <game id="game35"/>
    <game id="game36"/>
    <game id="game37"/>
    <game id="game38"/>
    <game id="game39"/>
  </user>
</users>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-27 01:35 UTC] chregu@php.net
Please try using this CVS snapshot:

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

Aditionally you can try a stable-snapshot, which should solve this problem, too.

  http://snaps.php.net/win32/php4-win32-stable.zip

chregu
 [2002-08-27 17:29 UTC] KingGeoffrey at yahoo dot com
fixed by - 4.2.3 - dev
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 18:01:35 2024 UTC