php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4908 'unset' inconsistency
Submitted: 2000-06-08 17:49 UTC Modified: 2000-06-09 15:23 UTC
From: thomasjf at seas dot upenn dot edu Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0 Release Candidate 2 OS: WinNT 4.0
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: thomasjf at seas dot upenn dot edu
New email:
PHP Version: OS:

 

 [2000-06-08 17:49 UTC] thomasjf at seas dot upenn dot edu
It seems that the 'unset' function fails to handle empty array keys properly:

<?

$z = array();
unset($key);

echo "Test unset with key = '$key'<br>\n";

$z[$key] = 1;
unset($z[$key]);

while( list($k, $v) = each($z) ){
  echo "$k: $v <br>\n";
}

$z = array();
$key = 9;

echo "Test unset with key = '$key'<br>\n";

$z[$key] = 1;
unset($z[$key]);

while( list($k, $v) = each($z) ){
  echo "$k: $v <br>\n";
}

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-09 15:23 UTC] andi at cvs dot php dot net
Fixed in latest CVS.
Thanks for the bug report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 04:01:31 2024 UTC