Req #62455 [Com]: last chance to work with __call by reference died after removing call-time-&
| From: | madsorcerer at gmail dot com | Date: | Tue, 28 Aug 2012 13:04:59 +0000 |
| Subject: | Req #62455 [Com]: last chance to work with __call by reference died after removing call-time-& | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172982@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62455&edit=1
ID: 62455
Comment by: madsorcerer at gmail dot com
Reported by: scout4u at ya dot ru
Summary: last chance to work with __call by reference died
after removing call-time-&
Status: Wont fix
Type: Feature/Change Request
Package: *General Issues
PHP Version: 5.4.4
Block user comment: N
Private report: N
New Comment:
I found, that it is possible to use $sm->test(array('data'=>&$data));
Not so good solution but still...
Previous Comments:
------------------------------------------------------------------------
[2012-07-09 06:46:23] scout4u at ya dot ru
You offer to work in artifishial maner and not in way:
$sm->letsGo($args);
Now we have decided to use construction:
$sm->need( 'funcName' );
sm_funcName( arg1,arg2 );
instead of
$sm->funcName( arg1,arg2 );
Alas I see nobody would revert references (by some mysterious reson).
------------------------------------------------------------------------
[2012-07-08 21:36:51] cataphract@php.net
A full example:
<?php
class A {
function __call($func, $args) {
$args[0] = 3;
}
}
$a = new A;
call_user_func_array([$a, 'foo'], [&$a]);
var_dump($a); //int(3)
------------------------------------------------------------------------
[2012-07-08 21:29:07] cataphract@php.net
Please see the documentation of call_user_func_array(). Unsurprisingly, it takes its arguments as an
array. So you would have:
call_user_func_array(array($this,$n), array(&$val))
------------------------------------------------------------------------
[2012-07-02 14:55:57] scout4u at ya dot ru
«You can still pass by reference to __call using call_user_func_array().»
When I try to launch: call_user_func_array(array($this,$n), &$val);
I have:
Call-time pass-by-reference has been removed in
When I try to launch: function __call($n, &$val)
I have:
Method smTest::__call() cannot take arguments by reference
What do you mean by «refs are available for call_user_func_array()»?
------------------------------------------------------------------------
[2012-07-02 14:29:44] scout4u at ya dot ru
Dear catagraph, Sorry I can't catch you. What do you mean? Do you mean that we can
work in maner I have submited before? But we can't.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=62455
--
Edit this bug report at https://bugs.php.net/bug.php?id=62455&edit=1