Edit report at http://bugs.php.net/bug.php?id=52976&edit=1
ID: 52976 Updated by: cataphr...@php.net Reported by: contact at jubianchi dot fr Summary: DOMAttribute 'disabled' can't have a value -Status: Open +Status: Bogus Type: Bug Package: DOM XML related Operating System: OS X 10.6.4 PHP Version: 5.3.3 Block user comment: N New Comment: This is expected behavior. Per the HTML spec, the value of the "disabled" attribute can only be "disabled". In HTML is valid is to omit this implied value. If you were to call saveXML, the result would be different. In any case, even if this were a bug, it would be libxml's, not PHP's. Previous Comments: ------------------------------------------------------------------------ [2010-10-02 22:37:05] contact at jubianchi dot fr Description: ------------ It seems like there's a bug when trying to set a value to the 'disabled' attribute using the DOMElement::setAttribute($name, $value) function. Test script: --------------- <?php $dom = new DOMDocument(); $a = $dom -> createElement('input'); $a -> setAttribute('disabled', 'ok'); $dom -> appendChild($a); $b = $dom -> createElement('input'); $b -> setAttribute('disabled', 'somethingelse'); $dom -> appendChild($b); $c = $dom -> createElement('input'); $c -> setAttribute('required', 'required'); $dom -> appendChild($c); echo $dom ->saveHTML(); ?> Expected result: ---------------- <input disabled="disabled"><input disabled="somethingelse"><input required="required"> Actual result: -------------- <input disabled><input disabled><input required="required"> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52976&edit=1