#34468 [Bgs->Csd]: Fatal error for current
| From: | sniper@php.net | Date: | Fri, 16 Sep 2005 07:48:49 +0000 |
| Subject: | #34468 [Bgs->Csd]: Fatal error for current | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85137@lists.php.net to get a copy of this message | ||
ID: 34468
Updated by: sniper@php.net
Reported By: j dot gizmo at aon dot at
-Status: Bogus
+Status: Closed
-Bug Type: Reproducible crash
+Bug Type: Feature/Change Request
Operating System: Windows 2000 Server
PHP Version: 5.0.5
Assigned To: zeev
Previous Comments:
------------------------------------------------------------------------
[2005-09-12 11:17:52] j dot gizmo at aon dot at
Okay, this bug isn't critical, but why is it a bogus? Is
current() supposed to work on variables only? In all previous
versions of PHP it worked on all arrays, wheter returned from
a function or stored in a variable or whatever. So WHY the new
behaviour starting with 5.0.5?
------------------------------------------------------------------------
[2005-09-11 23:43:45] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Feel free to fix the whole engine though with a patch...
------------------------------------------------------------------------
[2005-09-11 23:35:16] 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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34468&edit=1