[PHP-DEV] PHP 4.0 Bug #5688: Unset() inconsistent treatment of resource values not as integers From: mlemos <email protected>
Date: 07/20/00

From: mlemos <email protected>
Operating system: Linux RH 6
PHP version: 4.0.0
PHP Bug Type: Misbehaving function
Bug description: Unset() inconsistent treatment of resource values not as integers

Resource values like those returned by ImageCreate() are integers, despite when
they are echo'ed they expand to something like "Resource id #nnn".

However, it seems that when a resource value is used and array index,
Unset() does not take it as an integer unless you explicitly cast the
value. Try this script to see the problem.

<?
 $resource=ImageCreate(1,1);
 $array=array();
 $array[$resource]=1;
 Unset($array[$resource]);
 echo IsSet($array[$resource])," ",serialize($array)," ",$resource," ",intval($resource),"\n";
 Unset($array[intval($resource)]);
 echo IsSet($array[$resource])," ",serialize($array)," ",$resource," ",intval($resource),"\n";
?>

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>