From:             mail at garv dot in
Operating system: Linux
PHP version:      5.1.2
PHP Bug Type:     Scripting Engine problem
Bug description:  Function call by reference: undocumented BC-break

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 bug report at http://bugs.php.net/?id=36022&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36022&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36022&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36022&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36022&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36022&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36022&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36022&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36022&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36022&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36022&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36022&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36022&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36022&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36022&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36022&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36022&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36022&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36022&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36022&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36022&r=mysqlcfg

Reply via email to