ID:               28016
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at ter dot dk
 Status:           Assigned
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      4CVS, 5CVS (2004-04-16)
 Assigned To:      derick
 New Comment:

No, the fix was correct. Close() in this case destroyed the resource
data in the variable, so it's no longer a resource anymore. I think the
correct thing to do here is to make gettype() not show "resource"
either.


Previous Comments:
------------------------------------------------------------------------

[2004-04-15 22:35:54] [EMAIL PROTECTED]

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'.. :)



------------------------------------------------------------------------

[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

Reply via email to