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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: j dot gizmo at aon dot at
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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 Mar 28 10:01:26 2024 UTC