DOMNode::getAttribute()

From: Date: Fri, 03 Jun 2011 20:38:00 +0000
Subject: DOMNode::getAttribute()
Groups: php.internals 
Request: Send a blank email to internals+get-52871@lists.php.net to get a copy of this message
Hello, I discovered today that the DOMNode::getAttribute() function (which is undocumented on the php site) returns an empty string if the requested attribute doesn't exist in the node. From the source: if (value == NULL) { RETURN_EMPTY_STRING(); } else { RETVAL_STRING((char *)value, 1); xmlFree(value); } Seems to me that it should return NULL. (That's what libxml does, apparently.) Does anyone know of a particular reason it returns an empty string instead? Does anyone know of a particular reason it is not documented? (I'd be happy to document and provide the ridiculously simple patch of returning NULL...) Thanks, -Matt

« previous php.internals (#52871) next »