php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22774 PHP crashes when exiting (long XML doc)
Submitted: 2003-03-18 16:19 UTC Modified: 2003-04-07 02:17 UTC
From: fgarcia at uef dot es Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.3.2RC1 OS: Windows 2000
Private report: No CVE-ID:
 [2003-03-18 16:19 UTC] fgarcia at uef dot es
Runnig the following script (php -q domtest.php), you will get a Windows System Error when the script ends.
The Error depends on the internal size of the xml document.
If the 'for' is of 100 iterations, the error no happen.

(I'm using the Windows compilation downloaded from php.net. Same problem in version 4.3.0)


domtest.php:
<?
if (!extension_loaded("php_domxml")) @dl("php_domxml.dll");
$domR=domxml_new_doc('1.0');

$nItinerario = $domR->create_element("itinerario");
for ($i=0; $i<400; $i++) {
	$n=$domR->create_element("HH");
	$n->append_child($domR->create_text_node('long long long long long long long long long long long long'));
	$nItinerario->append_child($n);
}
$domR->append_child($nItinerario);
//$xml=$domR->dump_mem();
//echo $xml;
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-18 16:21 UTC] fgarcia at uef dot es
Sorry, on Windows 2000
 [2003-03-18 20:18 UTC] sniper@php.net
I can not reproduce this on Linux using latest stable CVS snapshot with the example script. Maybe it's win32 only bug?

 [2003-03-18 20:19 UTC] sniper@php.net
Are you sure you really are using the 4.3.2RC1 ???

 [2003-03-20 09:29 UTC] fgarcia at uef dot es
I have tested only in 4.3.0 and 4.3.2RC1 win32 versions.
Both have the same problem.
 [2003-03-20 11:32 UTC] fgarcia at uef dot es

 [2003-03-20 17:47 UTC] sniper@php.net
Please try using this CVS snapshot:

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

And make sure you really update it. Especially the php4ts.dll file.

 [2003-03-21 04:28 UTC] fgarcia at uef dot es
I've updated to 4.3.2-RC1 version, and updated php4ts.dll on winnt/system
Same bug.


php -v:
PHP 4.3.2-RC (cgi-fcgi), Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
 [2003-03-21 04:31 UTC] fgarcia at uef dot es
If you see DrWatson output there is the function zend_timeout 

I don't know if that matchs something.
 [2003-03-21 05:43 UTC] chregu@php.net
looks like a mem-leak

linux normally doesn't segfault on memleaks. Windows does... that's the difference ;)

I try to look at it
 [2003-03-24 05:02 UTC] rrichards at digarc dot com
Am not able to reproduce in Win 2K. Ran it for 10,000 and 20,000 iterations without a problem. Finally ran it for 1,000,000 iterations until the machine ran out of memory (was over a Gig of used memory at that point).
Once getting a fatal emalloc error memory returned back to normal (exact amount used prior to running).

Tested against latest cvs code as well as a php4-3.0-dev build from jun 2002.

using libxml2-2.4.22
 [2003-03-27 11:24 UTC] rrichards at digarc dot com
Finally able to reproduce this using a simplified script:
<?php
if (!extension_loaded("domxml")) @dl("php_domxml.dll");
$domR=domxml_new_doc('1.0');
$nItinerario = $domR->create_element("itinerario");
$domR->append_child($nItinerario);
?>

If the extension is NOT loaded via the php.ini file, upon shutdown, php_free_xml_doc is called first and then php_free_xml_node for the created element is called which causes the blow up. If read from the ini file, php_free_xml_node is called first and then php_free_xml_doc.

Seems to be some issue with the external loading of the extension.
 [2003-04-03 04:38 UTC] chregu@php.net
Please try using this CVS snapshot:

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

Should be fixed in the stable release, as well.
 [2003-04-07 02:17 UTC] fgarcia at uef dot es
I've tried
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
and works fine.

Thanks.
Fernando
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 19:01:53 2014 UTC