|  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
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-09-21 21:11 UTC] johnkarl at nbnet dot nb dot ca
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, 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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-27 19:47 UTC]
Please try using this CVS snapshot:
For Windows:

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

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.

 [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
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 00:01:32 2024 UTC