#47664 [Asn->Csd]: get_class returns NULL instead of FALSE.
| From: | dmitry@php.net | Date: | Mon, 16 Mar 2009 09:53:51 +0000 |
| Subject: | #47664 [Asn->Csd]: get_class returns NULL instead of FALSE. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134732@lists.php.net to get a copy of this message | ||
ID: 47664
Updated by: dmitry@php.net
Reported By: wiebe at wiebelt dot nl
-Status: Assigned
+Status: Closed
Bug Type: Class/Object related
Operating System: Ubuntu 8.10
PHP Version: 5.3.0beta1
Assigned To: dmitry
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2009-03-15 18:10:28] pajoye@php.net
hm, you are right. It should remain the same especially as it is
documented. Dmitry?
------------------------------------------------------------------------
[2009-03-15 17:44:48] wiebe at wiebelt dot nl
The documentation says it should return false.
"Returns the name of the class of which object is an instance. Returns
FALSE if object is not an object."
It's very inconsistent if in PHP 5.2 it returns false and in 5.3 null.
------------------------------------------------------------------------
[2009-03-15 15:22:38] pajoye@php.net
invalid argument returns NULL, not false.
------------------------------------------------------------------------
[2009-03-15 15:13:59] wiebe at wiebelt dot nl
Description:
------------
get_class returns NULL when using it with a string instead of FALSE.
Reproduce code:
---------------
<?php
var_dump(get_class('test'));
Expected result:
----------------
bool(false)
Actual result:
--------------
Warning: get_class() expects parameter 1 to be object, string given in
/home/wiebe/run.php on line 34
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47664&edit=1