From: mjomble at gmail dot com Operating system: Windows PHP version: 5.3.0 PHP Bug Type: Feature/Change Request Bug description: Allow & when passing parameters by reference
Description: ------------ NB! I'm not asking for the un-deprecation of call-time pass-by-reference. The way I understand it, this could previously alter the behavior of a function at call time. I agree that this can make things ugly and I can see the reason for it being deprecated. However, I would still like to be able to use the & for decorative purposes. When you see a call to a function without knowing/remembering/looking up the function definition, there's no way of telling whether the call can modify the variable or not. In most cases, it is simply assumed that parameters are not passed by reference and will have the exact same value after the call. Which can cause problems when they're actually passed by reference. Currently, to avoid such problems, I often add comments like this: // $someParameter is passed by reference and may be modified by someMethod() $someObject->someMethod($someParameter); It would make things much clearer if it could be called like in the reproduce code, but ONLY if the function actually uses the first parameter by reference. Reproduce code: --------------- $someObject->someMethod(&$someParameter); Expected result: ---------------- If the definition of someMethod() does not use the first parameter by reference, a warning should appear. Otherwise, the code should execute normally. Actual result: -------------- A warning always appears, regardless of how the parameter is used. -- Edit bug report at http://bugs.php.net/?id=49485&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49485&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49485&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49485&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49485&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49485&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49485&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49485&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49485&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49485&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49485&r=support Expected behavior: http://bugs.php.net/fix.php?id=49485&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49485&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49485&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49485&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49485&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49485&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49485&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49485&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49485&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49485&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49485&r=mysqlcfg