ID:               38808
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dev at ioncube dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         Variables related
 Operating System: Any
 PHP Version:      5.1.6
-Assigned To:      
+Assigned To:      dmitry
 New Comment:

Dmitry, any ideas?


Previous Comments:
------------------------------------------------------------------------

[2006-09-14 11:25:20] dev at ioncube dot com

"The point is that whether to send a parameter by ref or not is
determined in _COMPILE TIME_."

Correct :) Prior to 5.1, whether a function accepted a value by
reference or value was a boolean decision, and the code in the
executor, (which is still there), would promote the passed variable to
by reference if the function required it. This is how and why the
function next() would still work in this example for even a dynamic
call because the parameter must be a reference, and that logic still
works.

As of 5.1.0 the test became numeric to distinguish the "should be" and
"maybe cases", and the executor only checks for whether a parameter
should be passed by reference and not whether it may be. As a result,
the change to pass by reference does not happen for current even though
it is a valid candidate.

------------------------------------------------------------------------

[2006-09-14 10:55:22] [EMAIL PROTECTED]

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.

------------------------------------------------------------------------

[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

Reply via email to