#29029 [Opn->Csd]: Object to integer typecast is incorrect

From: Date: Sat, 18 Sep 2004 18:57:46 +0000
Subject: #29029 [Opn->Csd]: Object to integer typecast is incorrect
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969364157@lists.php.net to get a copy of this message
ID: 29029 Updated by: vrana@php.net Reported By: tomas_matousek at hotmail dot com -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: WinXP PHP Version: 5.0.0RC3 New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2004-09-10 05:36:18] curt@php.net This behaviour is expected, moving over as a documentation problem. Casting Objects: int - not able to cast dobule - notice thrown, returns 1.0 null - returns null bool - returns 1 string - user __toString() if applicable or 'Object' ze1_compatibility_mode casting object int/float/bool - 1 or 0 signifying it has properties ------------------------------------------------------------------------ [2004-07-14 15:45:56] php at hristov dot com php -r '$a= (float) new stdClass(); var_dump($a);' gives float(1) ------------------------------------------------------------------------ [2004-07-06 14:59:38] tomas_matousek at hotmail dot com Description: ------------ No description needed. Reproduce code: --------------- var_dump((int) new stdClass()); Expected result: ---------------- 0 Actual result: -------------- object(stdClass)#2 (0) { } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29029&edit=1

« previous php.doc (#969364157) next »