From: Operating system: Windows 7 PHP version: 5.3.6 Package: Scripting Engine problem Bug Type: Bug Bug description:@ Error control operator prevents creation of variable
Description: ------------ When a function is defined with a parameter that is passed by reference, calling the function with a variable that has not been previously set will create that variable (and trigger a warning). After the function is called that variable exists (won't trigger warnings) and holds null or whatever value the function assigned to it. If you try to suppress the warning for the variable that doesn't exist at call time, it will not be created, and trying to access it after the function triggers warnings. It works as expected if you suppress errors on the function call but this is not desirable because it will also hide other errors. Test script: --------------- <?php function foo(&$bar) { $bar = 'woo'; } @foo($x); foo(@$y); var_dump($x, $y); Expected result: ---------------- string(3) "woo" string(3) "woo" Actual result: -------------- Notice: Undefined variable: y in FILE on line LINE string(3) "woo" NULL -- Edit bug report at https://bugs.php.net/bug.php?id=55278&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55278&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55278&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55278&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55278&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55278&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55278&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55278&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55278&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55278&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55278&r=support Expected behavior: https://bugs.php.net/fix.php?id=55278&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55278&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55278&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55278&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55278&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=55278&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55278&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55278&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55278&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55278&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55278&r=mysqlcfg