Bug #72038 [NEW]: Function calls with values to a by-ref parameter don't always throw a notice

From: Date: Sat, 16 Apr 2016 17:53:36 +0000
Subject: Bug #72038 [NEW]: Function calls with values to a by-ref parameter don't always throw a notice
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200599@lists.php.net to get a copy of this message
From: bwoebi Operating system: Irrelevant PHP version: master-Git-2016-04-16 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Function calls with values to a by-ref parameter don't always throw a notice Description: ------------ The following works as expected (with the first parameter of test() accepting a reference) and doesn't throw a notice: test($foo = 2 /* anything not being an object */); But objects omit that notice. Seems to be a PHP 4 relict, but today this should definitely emit a notice. Test script: --------------- test($foo = new stdClass); function test(&$param) { $param = 1; } var_dump($foo); Expected result: ---------------- Notice: Only variables should be passed by reference in - on line 5 object(stdClass)#1 (0) { } Actual result: -------------- object(stdClass)#1 (0) { } -- Edit bug report at https://bugs.php.net/bug.php?id=72038&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72038&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72038&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72038&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72038&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72038&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72038&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72038&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72038&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72038&r=support Expected behavior: https://bugs.php.net/fix.php?id=72038&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72038&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72038&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72038&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72038&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72038&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72038&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72038&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72038&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72038&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72038&r=mysqlcfg

« previous php.bugs (#200599) next »