Bug #80668 [Dup]: passed by reference upgraded from notice to error
| From: | cmb@php.net | Date: | Mon, 25 Jan 2021 14:37:55 +0000 |
| Subject: | Bug #80668 [Dup]: passed by reference upgraded from notice to error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231760@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80668&edit=1
ID: 80668
Updated by: cmb@php.net
Reported by: b dot lau at tamrael dot de
Summary: passed by reference upgraded from notice to error
Status: Duplicate
Type: Bug
Package: Reproducible crash
Operating System: linux
PHP Version: 7.4.14
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I tried the search as well, and also failed to find the ticket. :)
Previous Comments:
------------------------------------------------------------------------
[2021-01-25 14:28:57] b dot lau at tamrael dot de
I'm so sorry.
I swear I used the search but the linked bug wasn't showing up for me.
Thank you for the fast reply.
------------------------------------------------------------------------
[2021-01-25 14:24:48] cmb@php.net
This is a duplicate of bug #80486. Note that we have not
documented this in any changelog, since that only worked
coincidentally.
------------------------------------------------------------------------
[2021-01-25 14:18:05] nikic@php.net
This only affects cases where the passed function is a VM primitive (here "strval" is a
cast).
------------------------------------------------------------------------
[2021-01-25 14:00:23] b dot lau at tamrael dot de
Description:
------------
Since php version 7.4.9 and later, passing any non-variable to a function that expects a reference
results in an error.
From 7.1.0 to 7.4.8 the same would produce no warning, notice or anything and just work.
Before 7.1.0 this would issue a notice but still execute the code.
In 5.0.5 this would crash with an error.
Maybe this is missing documentation and not a bug but changing behavior like this inside a minor
version shouldn't be intended.
See https://3v4l.org/iUp7Q
Test script:
---------------
<?php
function test(&$var)
{
return $var;
}
echo test(strval('var'));
Expected result:
----------------
Output of "var" and a notice
Actual result:
--------------
fatal error
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80668&edit=1