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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 06 18:01:33 2024 UTC