Doc #74850 [NEW]: current() and key() no longer take their parameter by reference

From: Date: Mon, 03 Jul 2017 17:00:50 +0000
Subject: Doc #74850 [NEW]: current() and key() no longer take their parameter by reference
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14816@lists.php.net to get a copy of this message
From: anon at example dot com Operating system: PHP version: 7.0.20 Package: Documentation problem Bug Type: Documentation Problem Bug description:current() and key() no longer take their parameter by reference 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 bug report at https://bugs.php.net/bug.php?id=74850&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74850&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74850&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74850&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74850&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74850&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74850&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74850&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74850&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74850&r=support Expected behavior: https://bugs.php.net/fix.php?id=74850&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74850&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74850&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74850&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74850&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74850&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74850&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74850&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74850&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74850&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74850&r=mysqlcfg

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