php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30186 passing empty string to xml_parser_create causes 100% CPU utilization
Submitted: 2004-09-21 21:11 UTC Modified: 2005-02-20 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: johnkarl at nbnet dot nb dot ca Assigned:
Status: No Feedback Package: XML related
PHP Version: 5.0.1 OS: Windows 2000 Professional SP4
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: johnkarl at nbnet dot nb dot ca
New email:
PHP Version: OS:

 

 [2004-09-21 21:11 UTC] johnkarl at nbnet dot nb dot ca
Description:
------------
In PHP5, if xml_parser_create is called with an empty string as the character encoding parameter, a server will utilize 100% of the CPU. Restarting Apache will sometimes cause the system to revert to normal, but usually a reboot is needed.

In PHP4, calling xml_parser_create("") will cause Expat to autodetect the character encoding. In the user comments of www.php.net, this is purportedly true of PHP5 as well; however this is not the case.

This problem has been reproduced on a number of other machines as well. I'm not sure if the same happens with IIS.

Reproduce code:
---------------
$parser = xml_parser_create("");

Expected result:
----------------
a reference to the parser should be returned

Actual result:
--------------
Apache stalls, 100% CPU usage

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-27 19:47 UTC] iliaa@php.net
Please try using this CVS snapshot:

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

Seems to work fine in recent code.
 [2004-09-27 20:23 UTC] johnkarl at nbnet dot nb dot ca
Just tried it out with the snapshot you provided and still the same problem. Here are my specs:

Windows 2004 Professional SP4
Apache/2.0.49

My workaround is to check the PHP version, and omit the empty string parameter if version >= 5

This isn't an isolated problem, either. I became aware of this through several individuals using my open source libraries. I'm not certain what they were running but I can proably find out if you can't replicate the problem.

John
 [2005-02-20 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-09-09 10:44 UTC] GDG at FKJF dot HFJ
http://www.meta-fx.com/
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 16:01:29 2024 UTC