From: olivier dot bichler at laposte dot net
Operating system: Windows XP pro (SP1)
PHP version: 5.0.0b3 (beta3)
PHP Bug Type: *XML functions
Bug description: Crash by using DomDocument::getElementById()
Description:
------------
PHP crash by using the DOM function getElementById() (PHP kill the Apache
server process on Windows, with Apache v1.3.27 and v2.0.48).
Reproduce code:
---------------
<?php
$dom = new DomDocument;
$dom -> load('essai.xml');
if ($dom -> validate()) {
$menu = new DomDocument;
$menu = $dom -> getElementById('a');
echo $menu -> firstChild -> data;
}
?>
essai.xml :
-----------
<?xml version="1.0"?>
<!DOCTYPE essai [
<!ELEMENT essai (truc+)>
<!ELEMENT truc (#PCDATA)>
<!ATTLIST truc
id ID #REQUIRED>
]>
<essai>
<truc id="a">1</truc>
</essai>
Expected result:
----------------
1
Actual result:
--------------
Nothing, PHP and the server crash...
There is the same result with an external doctype.
When I call getElementById(id) with an id who doesn't exist in the XML
file, there is no crash.
--
Edit bug report at http://bugs.php.net/?id=26947&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26947&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26947&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26947&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26947&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26947&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26947&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26947&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26947&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26947&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26947&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26947&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26947&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26947&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26947&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26947&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26947&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26947&r=float