|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31441 passing by reference in variable-length argument lists
Submitted: 2005-01-07 13:44 UTC Modified: 2014-11-01 23:23 UTC
Avg. Score:4.0 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:2 (40.0%)
From: hagen at cookfast dot net Assigned: requinix (profile)
Status: Closed Package: *General Issues
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
12 + 44 = ?
Subscribe to this entry?

 [2005-01-07 13:44 UTC] hagen at cookfast dot net
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

// possible workaround now:
list($a,$b,$c) = my_conversion($a,$b,$c)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-11-01 23:23 UTC]
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: requinix
 [2014-11-01 23:23 UTC]
just pack the variables into an array lol

Kidding. Variadics in PHP 5.6 supports passing by-reference.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Jan 27 05:04:15 2023 UTC