Bug #72166 [Opn->Nab]: Empty SimpleXML elements

From: Date: Thu, 05 May 2016 22:43:35 +0000
Subject: Bug #72166 [Opn->Nab]: Empty SimpleXML elements
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200916@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72166&edit=1 ID: 72166 Updated by: requinix@php.net Reported by: rmoisto at gmail dot com Summary: Empty SimpleXML elements -Status: Open +Status: Not a bug Type: Bug Package: SimpleXML related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: SimpleXML does a lot of "magic" with some PHP behaviors. Most of it depends on the current working namespace, which is initially ""; methods like children() and attributes() will return a new object with a different namespace. Dumping the contents of the object will only show you XML nodes within the current namespace. https://3v4l.org/Nmf0G An object's boolean value depends on whether there are XML nodes in the current namespace. https://3v4l.org/6YOWK Previous Comments: ------------------------------------------------------------------------ [2016-05-05 15:00:28] rmoisto at gmail dot com Description: ------------ Creating a SimpleXMLElement on a soap envelope should not result in an empty object. It makes no sense. Also, now that I looked it up, empty SimpleXML objects cast to boolean will be false. That's so random and stupid. Why? ALL other objects cast to true. Test script: --------------- https://3v4l.org/vejJM ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72166&edit=1

« previous php.bugs (#200916) next »