php.net |  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 (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.5 OS: Windows 2000 Server
Private report: No CVE-ID: None
 [2005-09-11 23:35 UTC] j dot gizmo at aon dot at
Description:
------------
current() only works on variables; no longer on arrays 
returned from functions.

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

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

Expected result:
----------------
a

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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-16 09:49 UTC] sniper@php.net
current() is fixed in CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC