|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-05-18 22:37 UTC] tony2001@php.net
[2005-05-19 15:47 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 04:00:02 2025 UTC |
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."...