Req #81359 [Com]: assignement in function parameter

From: Date: Sat, 14 Aug 2021 11:19:34 +0000
Subject: Req #81359 [Com]: assignement in function parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235813@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81359&edit=1 ID: 81359 Comment by: rtrtrtrtrt at dfdfdfdf dot dfd Reported by: rh at hofercomputing dot ch Summary: assignement in function parameter Status: Open Type: Feature/Change Request Package: Compile Failure Operating System: windows PHP Version: 8.0.9 Block user comment: N Private report: N New Comment: fixed version of your code: $x=18; a($x); Previous Comments: ------------------------------------------------------------------------ [2021-08-14 11:18:26] rtrtrtrtrt at dfdfdfdf dot dfd sorry, but you don't understand your code! * you assign 18 to $x * you pass 18 to the function * 18 is not a variable buta literal int value * it makes no sense to write "$x=18" at a function call ------------------------------------------------------------------------ [2021-08-14 09:11:49] rh at hofercomputing dot ch Description: ------------ function a(&$p){ $p++; } a($x=18); this produces "Uncaught Error: a(): Argument #1 ($p) cannot be passed by reference in " but $x is a variable, and this was accepted in recent versions. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81359&edit=1

« previous php.bugs (#235813) next »