Req #31441 [Opn->Csd]: passing by reference in variable-length argument lists

From: Date: Sat, 01 Nov 2014 23:23:53 +0000
Subject: Req #31441 [Opn->Csd]: passing by reference in variable-length argument lists
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188409@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=31441&edit=1 ID: 31441 Updated by: requinix@php.net Reported by: hagen at cookfast dot net Summary: passing by reference in variable-length argument lists -Status: Open +Status: Closed Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues PHP Version: Irrelevant -Assigned To: +Assigned To: requinix Block user comment: N Private report: N New Comment: just pack the variables into an array lol Kidding. Variadics in PHP 5.6 supports passing by-reference. https://wiki.php.net/rfc/variadics#by-reference_capture Previous Comments: ------------------------------------------------------------------------ [2005-01-07 13:44:07] hagen at cookfast dot net Description: ------------ In my opinion it should be possible to pass by reference when using variable-length argument lists. I know that there are quite a lot of workarounds for this but none of them is really appealing to me. For the sake of orthogonality it should be possible to use user defined functions with variable-length argument lists in the same way as without. See my listing for a possible use of this. Do not tell me these variables could be packed into an array. This feature request does not contain scope inheritance as requested in bug #11472. Reproduce code: --------------- // We've got some strings from user input // named $a, $b and $c // and want them to be escaped and converted somehow // with passing by reference this could look like my_conversion($a,$b,$c); // possible workaround now: list($a,$b,$c) = my_conversion($a,$b,$c) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=31441&edit=1

« previous php.bugs (#188409) next »