|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52976 DOMAttribute 'disabled' can't have a value
Submitted: 2010-10-02 22:37 UTC Modified: 2010-10-02 23:53 UTC
From: contact at jubianchi dot fr Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.3.3 OS: OS X 10.6.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
40 - 38 = ?
Subscribe to this entry?

 [2010-10-02 22:37 UTC] contact at jubianchi dot fr
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:
$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">


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-02 23:53 UTC]
-Status: Open +Status: Bogus
 [2010-10-02 23:54 UTC]
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.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jan 21 05:01:23 2021 UTC