#33059 [NEW]: Apache crash when moving xml attribute set in dtd
From: dikrib at hotmail dot com
Operating system: Windows XP
PHP version: 5.0.4
PHP Bug Type: DOM XML related
Bug description: Apache crash when moving xml attribute set in dtd
Description:
------------
If I try to remove an attribute from an xml document using the dom, where
the xml document is validated against a doctype, and the dtd specifies a
default value for the attribute, PHP crashes if the attribute is not
defined.
My guess is that the default value is receaved from the dtd, and php
therefore beleaves that the attribute exists and passes the error
checking, that should have caused the removeAttribute property to return
false.
Tested on PHP 5.0.4 and php5.0-win32-200505181630
Reproduce code:
---------------
<?php
$doc = new DOMDocument();
$doc->validateOnParse = true;
$doc->loadXML('<?xml version="1.0"
encoding="iso-8859-1"?'.'>
<!DOCTYPE node [
<!ELEMENT node EMPTY>
<!ATTLIST node attr CDATA "">
]>
<node></node>');
$node = $doc->documentElement;
$node->removeAttribute('attr');
Expected result:
----------------
the removeAttribute property should return false, because the attribute is
not defined.
Actual result:
--------------
The webserver crashes.
I get a message from Windows saying:
"Apache.exe has encountered a problem and needs to close."...
--
Edit bug report at http://bugs.php.net/?id=33059&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33059&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33059&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33059&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33059&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33059&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33059&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33059&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33059&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33059&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33059&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33059&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33059&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33059&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33059&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33059&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33059&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33059&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33059&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33059&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33059&r=mysqlcfg
Thread (3 messages)
- dikrib at hotmail dot com