From:             php at ter dot dk
Operating system: Linux 2.4.17
PHP version:      4.3.6RC3
PHP Bug Type:     Unknown/Other Function
Bug description:  is_resource() returns false for resources of type "Unknown"

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 bug report at http://bugs.php.net/?id=28016&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28016&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28016&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28016&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28016&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28016&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28016&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28016&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28016&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28016&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28016&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28016&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28016&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28016&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28016&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28016&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28016&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28016&r=float

Reply via email to