#34468 [Bgs->Ctl]: Fatal error for current
| From: | pajoye@php.net | Date: | Sun, 11 Sep 2005 22:17:57 +0000 |
| Subject: | #34468 [Bgs->Ctl]: Fatal error for current | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-84880@lists.php.net to get a copy of this message | ||
ID: 34468
Updated by: pajoye@php.net
Reported By: j dot gizmo at aon dot at
-Status: Bogus
+Status: Critical
Bug Type: Reproducible crash
Operating System: Windows 2000 Server
PHP Version: 5.0.5
-Assigned To:
+Assigned To: zeev
New Comment:
> Feel free to fix the whole engine though with a patch...
Who broke it is a more appropriate question. By "broke it" I mean
applied your patch to the 5.0 branche.
Assign to the RM.
Since when we broke running scripts between bug fixes releases (ie
5.0.5). Whether this code is bad (it was not until recently, how can
one knows?) or not is not the point.
Any good explanation? I do not consider "Your code is bad" as a good
one.
Previous Comments:
------------------------------------------------------------------------
[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