Bug #70668 [NEW]: array_keys() doesn't respect references when $strict is true

From: Date: Thu, 08 Oct 2015 11:51:55 +0000
Subject: Bug #70668 [NEW]: array_keys() doesn't respect references when $strict is true
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196486@lists.php.net to get a copy of this message
From: dmitry Operating system: * PHP version: 7.0Git-2015-10-08 (Git) Package: Arrays related Bug Type: Bug Bug description:array_keys() doesn't respect references when $strict is true Description: ------------ Comparison of references doesn't work properly when $strict argument is true. Test script: --------------- <?php $arr = array(1, "1", "", NULL, 0, false, true, array()); $s = &$arr[0]; var_dump(array_keys($arr, $s, true)); $s = &$arr[1]; var_dump(array_keys($arr, $s, true)); $s = &$arr[2]; var_dump(array_keys($arr, $s, true)); $s = &$arr[3]; var_dump(array_keys($arr, $s, true)); $s = &$arr[4]; var_dump(array_keys($arr, $s, true)); $s = &$arr[5]; var_dump(array_keys($arr, $s, true)); $s = &$arr[6]; var_dump(array_keys($arr, $s, true)); $s = &$arr[7]; var_dump(array_keys($arr, $s, true)); ?> Expected result: ---------------- array(1) { [0]=> int(0) } array(1) { [0]=> int(1) } array(1) { [0]=> int(2) } array(1) { [0]=> int(3) } array(1) { [0]=> int(4) } array(1) { [0]=> int(5) } array(1) { [0]=> int(6) } array(1) { [0]=> int(7) } Actual result: -------------- array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } array(0) { } -- Edit bug report at https://bugs.php.net/bug.php?id=70668&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70668&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70668&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70668&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70668&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70668&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70668&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70668&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70668&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70668&r=support Expected behavior: https://bugs.php.net/fix.php?id=70668&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70668&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70668&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70668&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70668&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70668&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70668&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70668&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70668&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70668&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70668&r=mysqlcfg

« previous php.bugs (#196486) next »