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

From: Date: Sat, 16 Apr 2016 18:00:43 +0000
Subject: Bug #72038 [Opn->Asn]: Function calls with values to a by-ref parameter don't always throw a notice
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200600@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72038&edit=1 ID: 72038 Updated by: bwoebi@php.net Reported by: bwoebi@php.net Summary: Function calls with values to a by-ref parameter don't always throw a notice -Status: Open +Status: Assigned Type: Bug Package: Scripting Engine problem Operating System: Irrelevant PHP Version: master-Git-2016-04-16 (Git) -Assigned To: +Assigned To: bwoebi Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2016-04-16 17:53:33] bwoebi@php.net 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 this bug report at https://bugs.php.net/bug.php?id=72038&edit=1

« previous php.bugs (#200600) next »