#38808 [Opn]: "maybe ref" issue for current() and others
ID: 38808
Updated by: tony2001@php.net
Reported By: dev at ioncube dot com
Status: Open
Bug Type: Variables related
Operating System: Any
PHP Version: 5.1.6
New Comment:
Heh, that's actually interesting.
The point is that whether to send a parameter by ref or not is
determined in _COMPILE TIME_.
Apparently it's not possible to detect it in this case, since the value
of $f is not known at that moment.
Previous Comments:
------------------------------------------------------------------------
[2006-09-13 14:50:06] dev at ioncube dot com
Description:
------------
Minor issue; the implementation of "maybe reference" parameters since
5.1.0 (and still present in 5.2RC2) can cause unexpected results.
Reproduce code:
---------------
<?php
$b = array(1=>'one', 2=>'two');
$a =& $b;
var_dump(current($a));
next($a);
$f = "current";
var_dump($f($a));
?>
Expected result:
----------------
string(3) "one"
string(3) "two"
Actual result:
--------------
string(3) "one"
string(3) "one"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38808&edit=1
Thread (5 messages)