#45666 [Com]: getElementsByTagName returns NULL

From: Date: Thu, 31 Jul 2008 14:30:41 +0000
Subject: #45666 [Com]: getElementsByTagName returns NULL
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-127437@lists.php.net to get a copy of this message
ID: 45666 Comment by: matthias dot sojka at gmail dot com Reported By: matthias dot sojka at gmail dot com Status: Open Bug Type: DOM XML related Operating System: Linux Slackware 12 PHP Version: 5.2.6 New Comment: Code wasn't complete. I'm sorry for this. $oElement = $this->_oDom->getElementsByTagName($this->_prepareKeyName(true, $sName))->item(0); $sFirstChar = $sName{0}; if (($sFirstChar !== 'i') && ($sFirstChar !== 'b') && ($sFirstChar !== 'f')) { $oChild = $this->_oDom->createElement($this->_prepareKeyName(true, $sName)); $oChild->appendChild($this->_oDom->createCDATASection($mValue)); $this->_oDom->documentElement->replaceChild($oChild, $oElement); } Previous Comments: ------------------------------------------------------------------------ [2008-07-31 14:25:01] matthias dot sojka at gmail dot com Description: ------------ I don't understand why, but on PHP 5.2.6 oDom->getElementsByTagName() delivers NULL. I didn't have that problem with 5.2.5. Our framework is working fine on our PHP 5.2.5 Machines and my local MAMP. Reproduce code: --------------- if (($sFirstChar !== 'i') && ($sFirstChar !== 'b') && ($sFirstChar !== 'f')) { $oChild = $this->_oDom->createElement($this->_prepareKeyName(true, $sName)); @ $oChild->appendChild($this->_oDom->createCDATASection($mValue)); @ $this->_oDom->documentElement->replaceChild($oChild, $oElement); } Expected result: ---------------- An instance of DOM-Document should be returned. Actual result: -------------- NULL returned. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45666&edit=1

« previous php.bugs (#127437) next »