#36022 [Opn->Bgs]: Function call by reference: undocumented BC-break
| From: | derick@php.net | Date: | Sun, 15 Jan 2006 15:12:44 +0000 |
| Subject: | #36022 [Opn->Bgs]: Function call by reference: undocumented BC-break | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-91951@lists.php.net to get a copy of this message | ||
ID: 36022
Updated by: derick@php.net
Reported By: mail at garv dot in
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.1.2
New Comment:
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same.
Thank you for your interest in PHP.
Duplicate of: #35995.
Previous Comments:
------------------------------------------------------------------------
[2006-01-15 16:08:32] mail at garv dot in
Description:
------------
When calling a function that expects an argument as a referenced
variable, you cannot pass an assignment operation to the function. If
doing so, the function will not change the assignment operation by
reference.
This has worked before PHP 5.1.2.
Reproduce code:
---------------
<?php
function myFunc(&$var) {
$var = 'set in function';
}
$var = 'set before function';
myFunc($var = 'set in function call');
var_dump($var);
?>
Expected result:
----------------
PHP lower than 5.1.2 reported "set in function", which is the expected
behaviour.
Actual result:
--------------
PHP 5.1.2 actually reports "set in function call", which is not the
expected behaviour and thus a BC break.
I guess this change is a side-effect of recent "return by reference"
problems that were addressed in PHP 4.4 already.
I personally do not use code above, but other PHP applications like
phpMyAdmin do (did). So at least having this documented in the PHP5
ChangeLog as a BC break would've been nice - just in case this change
is "by intention".
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36022&edit=1