Re: RFC: allow_call_pass_by_reference
| From: | Steph Fox | Date: | Thu, 29 May 2008 20:39:24 +0000 |
| Subject: | Re: RFC: allow_call_pass_by_reference | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-38002@lists.php.net to get a copy of this message | ||
Hi Derick,
I don't think we should get rid of it, or add a notice/message/whatever. Because this: http://pastebin.com/d6e055957 could not be done without call time pass by ref right now. So unless that's fixed, we shouldn't deprecate it.Hm. Actually those 'expected values' are wrong because 12 is itself an array and so isn't seen as an array element. But I take your point. On the other hand, call_time_pass_reference already *is* deprecated and has been for the last 8 years, so maybe fixing PHP to allow it where it makes sense might be a good way to go? Johannes mentioned call_user_func() on irc too: <?php function increment(&$var) { $var++; } $a = 0; call_user_func('increment', $a); echo $a; Warning: Parameter 1 to increment() expected to be a reference, value given in... 0 $b = 0; call_user_func('increment', &$b); echo $b; Deprecated: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of call_user_func(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in... 1 The manual advises that you use call_user_func_array() instead - which doesn't throw a warning - and virtually all the user notes recommend variable functions as both faster and safer than call_user_func(). So why isn't _that_ deprecated if call_time_pass_reference is? - Steph