#36841 [Opn->Bgs]: Empty objects are false?

From: Date: Fri, 24 Mar 2006 09:03:39 +0000
Subject: #36841 [Opn->Bgs]: Empty objects are false?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-94828@lists.php.net to get a copy of this message
ID: 36841 Updated by: tony2001@php.net Reported By: clemens at gutweiler dot net -Status: Open +Status: Bogus -Bug Type: Scripting Engine problem +Bug Type: SimpleXML related Operating System: Linux PHP Version: 5.1.2 New Comment: This is expected behaviour of SimpleXML (and it has nothing to do with the engine). No bug here. Previous Comments: ------------------------------------------------------------------------ [2006-03-24 10:00:12] clemens at gutweiler dot net Description: ------------ casting empty simplexml objects to boolean, empty objects get transformed to false. Reproduce code: --------------- var_dump( $foo = simplexml_load_string( "<foo />" ) ); object(SimpleXMLElement)#1 (0) { } var_dump( (bool)simplexml_load_string( "<foo />" ) ); bool(false) var_dump( (bool)simplexml_load_string( "<foo>foo</foo>" ) ); bool(true) Expected result: ---------------- both boolean-casts should be true. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36841&edit=1

« previous php.bugs (#94828) next »