#28016 [Opn->Asn]: is_resource() returns false for resources of type "Unknown"
| From: | sniper@php.net | Date: | Fri, 16 Apr 2004 02:35:55 +0000 |
| Subject: | #28016 [Opn->Asn]: is_resource() returns false for resources of type "Unknown" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58237@lists.php.net to get a copy of this message | ||
ID: 28016
Updated by: sniper@php.net
Reported By: php at ter dot dk
-Status: Open
+Status: Assigned
-Bug Type: Unknown/Other Function
+Bug Type: Scripting Engine problem
-Operating System: Linux 2.4.17
+Operating System: *
-PHP Version: 4.3.6
+PHP Version: 4CVS, 5CVS (2004-04-16)
-Assigned To:
+Assigned To: derick
New Comment:
Derick, IMO, the fix for bug #27822 was incorrect.
Resource is still a resource even if it's closed..
Or you need to unset the variable with any 'close'.. :)
Previous Comments:
------------------------------------------------------------------------
[2004-04-15 21:15:58] php at ter dot dk
Description:
------------
(version of PHP is 4.3.6, not 4.3.6RC3, but I wasn't able to select
that)
If a resource for some reason is of type "Unknown", is_resource()
returns false. Though, gettype() still returns "resource" as type, as
always.
This behaviour in is_resource() has changed between 4.3.5 and 4.3.6.
I'm guessing here, but the new behaviour could be related to changes
introduced to fix bug 27822 (which was fixed in between 4.3.5 and
4.3.6).
In my example I'm using php-imlib to gain an object of type "Unknown".
Even though it isn't an official extension, there still is some
inconsistency between gettype() returning "resource" and is_resource()
returning false. In other words, it's the inconsistency between
is_resource() and gettype() I see as the bug.
Example is also available at: http://stock.ter.dk/resource_error.php
Reproduce code:
---------------
$i = imlib_create_image(100,200);
var_dump($i);
var_dump(gettype($i));
var_dump(is_resource($i));
Expected result:
----------------
resource(2) of type (Unknown)
string(8) "resource"
bool(true)
Actual result:
--------------
resource(2) of type (Unknown)
string(8) "resource"
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28016&edit=1