Doc #74850 [Com]: current() and key() no longer take their parameter by reference
| From: | anon at example dot com | Date: | Wed, 12 Jul 2017 16:03:00 +0000 |
| Subject: | Doc #74850 [Com]: 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-14829@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
Comment by: anon at example dot com
Reported by: anon at example dot com
Summary: current() and key() no longer take their parameter
by reference
Status: Open
Type: Documentation Problem
Package: Documentation problem
PHP Version: 7.0.20
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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