php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5688 Unset() inconsistent treatment of resource values not as integers
Submitted: 2000-07-20 06:30 UTC Modified: 2000-07-24 10:43 UTC
From: mlemos at acm dot org Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0.0 OS: Linux RH 6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mlemos at acm dot org
New email:
PHP Version: OS:

 

 [2000-07-20 06:30 UTC] mlemos at acm dot org
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";
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-24 09:39 UTC] stas@php.net
Can't reporoduce here. Does it still happen in latest CVS?
 [2000-07-24 10:43 UTC] stas@php.net
fixed - closing
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 09:01:34 2025 UTC