Bug #70668 [Opn->Asn]: array_keys() doesn't respect references when $strict is true

From: Date: Thu, 08 Oct 2015 11:52:09 +0000
Subject: Bug #70668 [Opn->Asn]: array_keys() doesn't respect references when $strict is true
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196487@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70668&edit=1 ID: 70668 Updated by: dmitry@php.net Reported by: dmitry@php.net Summary: array_keys() doesn't respect references when $strict is true -Status: Open +Status: Assigned Type: Bug Package: Arrays related Operating System: * PHP Version: 7.0Git-2015-10-08 (Git) -Assigned To: +Assigned To: dmitry Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2015-10-08 11:51:54] dmitry@php.net 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 this bug report at https://bugs.php.net/bug.php?id=70668&edit=1

« previous php.bugs (#196487) next »