Edit report at http://bugs.php.net/bug.php?id=54698&edit=1
ID: 54698 Comment by: broshizzledizzle at gmail dot com Reported by: broshizzledizzle at gmail dot com Summary: setAttribute Status: Wont fix Type: Feature/Change Request Package: DOM XML related Operating System: (irrelevant) PHP Version: Irrelevant Block user comment: N Private report: N New Comment: I understood the implication of what I suggested when I posted. This exact same flaw happens in so many methods of the DOM that I always have to look up return values to see what actually gets returned, rather than what would be useful. I'm not looking to get into a fight, but think about what you said: "I don't think it would be a good idea to break backward compatibility now, even in a good cause." Doesn't that grate on your nerves? You are saying, we won't right the wrong we made in the beginning because a lot of people use this extension. Ever heard of investing in your future? I don't think PHP is going to die anytime soon, and if we're going to ever improve the DOM in this regard we'll probably never have a better time. It'll just get harder the longer we wait. Previous Comments: ------------------------------------------------------------------------ [2011-05-10 10:17:16] ahar...@php.net Given how widely the DOM extension is used, I don't think it would be a good idea to break backward compatibility now, even in a good cause. Closing won't fix. ------------------------------------------------------------------------ [2011-05-10 00:15:28] broshizzledizzle at gmail dot com Description: ------------ It makes more sense for setAttribute() to return the object it was called on instead of the attribute that was set. If I was interested in the attribute, I'd have use createAttribute() instead. Test script: --------------- $dom = new DOMDocument(); $body = $dom->createElement('body'); $dom->appendChild($body->setAttribute('class', 'wrapper')); echo $dom->saveHTML(); Expected result: ---------------- I would expect that it would properly append $body to the $dom. Actual result: -------------- Warning: DOMNode::appendChild() [domnode.appendchild]: Couldn't append node in _FILE_ on _LINE_. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54698&edit=1