#29029 [Opn]: Object to integer typecast is incorrect
| From: | curt@php.net | Date: | Fri, 10 Sep 2004 03:36:20 +0000 |
| Subject: | #29029 [Opn]: Object to integer typecast is incorrect | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969363933@lists.php.net to get a copy of this message | ||
ID: 29029
Updated by: curt@php.net
Reported By: tomas_matousek at hotmail dot com
Status: Open
-Bug Type: Zend Engine 2 problem
+Bug Type: Documentation problem
Operating System: WinXP
PHP Version: 5.0.0RC3
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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