php.net |  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
 [2010-10-02 22:37 UTC] 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">

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-02 23:53 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2010-10-02 23:54 UTC] cataphract@php.net
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-2020 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 09:01:23 2020 UTC