|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-04-24 13:55 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
Description: ------------ A call like addAttribute("attrname", "") results in "PHP Warning: SimpleXMLElement::addAttribute(): Attribute name and value are required". In addition to the warning, the attribute is discarded. Reproduce code: --------------- <?php $xml = new SimpleXmlElement("<img></img>"); $xml->addAttribute("src", "foo"); $xml->addAttribute("alt", ""); echo $xml->asXML()."\n"; ?> Expected result: ---------------- <?xml version="1.0"?> <img src="foo" alt=""/> Actual result: -------------- PHP Warning: SimpleXMLElement::addAttribute(): Attribute name and value are required in [...]/test.php on line 4 <?xml version="1.0"?> <img src="foo"/>