Bug #55135 [Asn->Csd]: Array keys are no longer type casted in unset()
| From: | dmitry@php.net | Date: | Wed, 06 Jul 2011 12:04:03 +0000 |
| Subject: | Bug #55135 [Asn->Csd]: Array keys are no longer type casted in unset() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161649@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55135&edit=1
ID: 55135
Updated by: dmitry@php.net
Reported by: damien at commerceguys dot com
Summary: Array keys are no longer type casted in unset()
-Status: Assigned
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.4SVN-2011-07-05 (SVN)
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-07-06 08:04:02] dmitry@php.net
Automatic comment from SVN on behalf of dmitry
Revision: http://svn.php.net/viewvc/?view=revision&revision=313005
Log: Fixed bug #55135 (Array keys are no longer type casted in unset())
------------------------------------------------------------------------
[2011-07-05 09:23:18] damien at commerceguys dot com
Description:
------------
An array key passed to unset() from a variable doesn't seem to be typecasted anymore.
Test script:
---------------
This doesn't work anymore in PHP 5.4:
<?php
// This fails.
$array = array(1 => 2);
$a = "1";
unset($array[$a]);
print_r($array);
// Those works.
$array = array(1 => 2);
$a = 1;
unset($array[$a]);
print_r($array);
$array = array(1 => 2);
unset($array[1]);
print_r($array);
$array = array(1 => 2);
$a = 1;
unset($array["1"]);
print_r($array);
?>
Expected result:
----------------
Array
(
)
Array
(
)
Array
(
)
Array
(
)
Actual result:
--------------
Array
(
[1] => 2
)
Array
(
)
Array
(
)
Array
(
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55135&edit=1