Doc #52059 [Opn->Csd]: get_class() throws warning instead of false on non-object vars
| From: | markskilbeck@php.net | Date: | Sat, 12 Jun 2010 19:46:11 +0000 |
| Subject: | Doc #52059 [Opn->Csd]: get_class() throws warning instead of false on non-object vars | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-4534@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52059&edit=1
ID: 52059
Updated by: markskilbeck@php.net
Reported by: shawn at thesignchef dot com
Summary: get_class() throws warning instead of false on
non-object vars
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: Linux ip-10-251-67-133 2.6.21.7
PHP Version: 5.3.2
-Assigned To:
+Assigned To: markskilbeck
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.
Actually, get_class() does return FALSE on error. It also raises an
error, as
you have said.
[code]
<?php
var_dump(get_class(array()));
[/code]
I have updated get_class()'s documentation to include this information.
Previous Comments:
------------------------------------------------------------------------
[2010-06-11 23:45:41] shawn at thesignchef dot com
Description:
------------
get_class() throws warning instead of false on non-object vars.
Per documentation, it is supposed to just return false.
Test script:
---------------
$foo = "test";
get_class($foo); // throws E_WARNING
Expected result:
----------------
For the function to simply return false without throwing an E_WARNING
Actual result:
--------------
get_class() expects parameter 1 to be object, string given
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52059&edit=1