php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54998 DOMElement::setAttribute fails if the value is : "0"
Submitted: 2011-06-06 10:01 UTC Modified: 2013-02-18 00:34 UTC
From: ealexs at gmail dot com Assigned: rrichards (profile)
Status: No Feedback Package: DOM XML related
PHP Version: 5.3.6 OS: Debian squeeze1
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-06-06 10:01 UTC] ealexs at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/domelement.setattribute#Description
---

DOMElement::setAttribute fails if the value is : "0" (or 0 as numeric)



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-06 11:17 UTC] johannes@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: rrichards
 [2011-06-07 10:15 UTC] bjori@php.net
-Status: Assigned +Status: Feedback
 [2011-06-07 10:15 UTC] bjori@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

No it doesn't:
bjori@foobar:~$ php -derror_reporting=-1
<?php
$doc = new DOMDocument("1.0");
$node = $doc->createElement("para");
$newnode = $doc->appendChild($node);

$n = $newnode->setAttribute("align", 0);
$x = $newnode->setAttribute("align2", "0");      
var_dump($n, $x);

print $doc->saveXML();

object(DOMAttr)#3 (0) {
}
object(DOMAttr)#4 (0) {
}
<?xml version="1.0"?>
<para align="0" align2="0"/>
bjori@foobar:~$
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 28 06:03:41 2022 UTC