Doc #74850 [Opn->Csd]: current() and key() no longer take their parameter by reference

From: Date: Mon, 21 Aug 2017 11:24:19 +0000
Subject: Doc #74850 [Opn->Csd]: current() and key() no longer take their parameter by reference
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14901@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74850&edit=1 ID: 74850 Updated by: cmb@php.net Reported by: anon at example dot com Summary: current() and key() no longer take their parameter by reference -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: 7.0.20 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Thanks for the report and the good patch! Previous Comments: ------------------------------------------------------------------------ [2017-08-21 11:23:06] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&revision=342894 Log: Fix bug #74850 current() and key() no longer take their parameter by reference (in PHP 7) -- Provided by anonymous 84565 () ------------------------------------------------------------------------ [2017-07-12 16:02:56] anon at example dot com Thanks to whoever cancelled my incomplete "Work in progress" and unlocked the files! Finally I have been able to submit a complete "Patch for review": https://edit.php.net/?patchID=2567&project=PHP ------------------------------------------------------------------------ [2017-07-03 17:00:46] anon at example dot com Description: ------------ --- From manual page: http://www.php.net/function.current --- The "effective prototype" of function current has actually been changed from mixed current ( array &$array ) to mixed current ( array $array ) by this commit: https://github.com/php/php-src/commit/745504ea2a7066588af9714f5e32523a3fff4db7 and similarly for function key. That is: Starting with PHP version 7.0.0, current() and key() no longer take their parameter by reference (but always by value). Moreover, prior to this version, they *preferred* to take it by reference if possible, but still accepted it by value otherwise. This can be compared to e.g. function reset, which always takes its parameter by reference. --- Here's a live example that current() and key() do not take the parameter by reference in PHP 7 (and also in PHP 4.4.1, maybe an old bug?), contrary to reset(): https://3v4l.org/BNkR8 https://3v4l.org/Eb8bc https://3v4l.org/7jpXG And here's a live example that they have long (always?) accepted an argument passed by value (except in PHP 5.0.5, maybe an old bug?), contrary to reset(): https://3v4l.org/COcBl https://3v4l.org/BPuff https://3v4l.org/6UVun --- N.B.: I had started to edit the docs at https://edit.php.net/?project=PHP&perm=en/function.current.php (and also file en/reference/array/functions/key.xml) as anonymous #84338, first just the prototypes (removed the role="reference"), but when I wanted to add a refsect1 role="changelog" then my browser crashed, and after logging in back, now those two files seem locked with a "Work in progress" I cannot cancel... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74850&edit=1

« previous php.doc.bugs (#14901) next »