php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72038 Function calls with values to a by-ref parameter don't always throw a notice
Submitted: 2016-04-16 17:53 UTC Modified: 2016-04-16 18:00 UTC
From: bwoebi@php.net Assigned: bwoebi
Status: Closed Package: Scripting Engine problem
PHP Version: master-Git-2016-04-16 (Git) OS: Irrelevant
Private report: No CVE-ID:
 [2016-04-16 17:53 UTC] 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) {
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-16 18:00 UTC] bwoebi@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: bwoebi
 [2016-04-16 18:36 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=15d1d4f45bea8c7f9eedf0534ffee804640baaf1
Log: Fixed bug #72038 (Function calls with values to a by-ref parameter don't always throw a notice)
 [2016-04-16 18:36 UTC] bwoebi@php.net
-Status: Assigned +Status: Closed
 [2016-04-16 18:38 UTC] bwoebi@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=15d1d4f45bea8c7f9eedf0534ffee804640baaf1
Log: Fixed bug #72038 (Function calls with values to a by-ref parameter don't always throw a notice)
 [2016-07-20 11:32 UTC] davey@php.net
Automatic comment on behalf of bobwei9@hotmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=15d1d4f45bea8c7f9eedf0534ffee804640baaf1
Log: Fixed bug #72038 (Function calls with values to a by-ref parameter don't always throw a notice)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sat Aug 19 05:01:35 2017 UTC