|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34468 Fatal error for current
Submitted: 2005-09-11 23:35 UTC Modified: 2005-09-16 09:49 UTC
From: j dot gizmo at aon dot at Assigned: zeev
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.5 OS: Windows 2000 Server
Private report: No CVE-ID:
 [2005-09-11 23:35 UTC] j dot gizmo at aon dot at
current() only works on variables; no longer on arrays 
returned from functions.

This also explains Bug #34424, which has been classified as 

Reproduce code:
$x = current(explode(' ','a b'));
echo $x;

Expected result:

Actual result:
Fatal error: Only variables can be passed by reference in ...

However, the following DOES work as expected:

$a = current($x=&explode(" ","a b"));

This new behaviour breaks backward compatibility. Furthermore, 
it introduces continuity problems. In both cases, an array is 
passed to current(), only one time it is stored in a variable 
and the other time it isn't. This should not make a 
difference, because even a "temporary array" should have a 
current element.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-16 09:49 UTC]
current() is fixed in CVS.
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Wed Nov 25 00:01:40 2015 UTC