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
 [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 14:01:29 2024 UTC