Edit report at https://bugs.php.net/bug.php?id=55135&edit=1
ID: 55135 User updated by: damien at commerceguys dot com Reported by: damien at commerceguys dot com Summary: Array keys are no longer type casted in unset() 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: Confirmed that this issue is fixed. Thanks. The bulk of the Drupal 8 test suite now passes on PHP 5.4 ;) Previous Comments: ------------------------------------------------------------------------ [2011-07-06 08:04:03] dmi...@php.net 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. ------------------------------------------------------------------------ [2011-07-06 08:04:02] dmi...@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