Bug #79765 [Opn->Nab]: undefined array index gets set when passed by reference

From: Date: Wed, 01 Jul 2020 14:09:07 +0000
Subject: Bug #79765 [Opn->Nab]: undefined array index gets set when passed by reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227762@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79765&edit=1 ID: 79765 Updated by: cmb@php.net Reported by: wspademan at gmail dot com Summary: undefined array index gets set when passed by reference -Status: Open +Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: Windows & Centos PHP Version: 8.0.0alpha1 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php See <https://www.php.net/manual/en/language.references.pass.php>. Previous Comments: ------------------------------------------------------------------------ [2020-07-01 13:43:16] wspademan at gmail dot com Description: ------------ This script apparently fails since PHP version 4.4.9 or earlier (tested using http://sandbox.onlinephpfunctions.com/) Test script: --------------- <?php function check(&$value) {} $a = array(); check($a['b']); echo count($a); // should be 0, but is 1 print_r($a); // $a should be [], but is ['b' => NULL] Expected result: ---------------- see comments in script Actual result: -------------- see comments in script ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79765&edit=1

« previous php.bugs (#227762) next »