Bug #18187: Consequent implementation of array referencing to user method
| From: | bram at totalgsm dot net | Date: | Fri, 05 Jul 2002 15:46:28 +0000 |
| Subject: | Bug #18187: Consequent implementation of array referencing to user method | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-13232@lists.php.net to get a copy of this message | ||
From: bram@totalgsm.net
Operating system: any
PHP version: 4.2.1
PHP Bug Type: Feature/Change Request
Bug description: Consequent implementation of array referencing to user method
You support calling user methods using an array in the call_user_func()
function. But related functions of call_user_func() don't support the
syntax. I would like to see that function_exists could check if the user
method exists.
The following example code should work:
class Foo {
function bar($what = 'world') {
print 'Hello ' . $what;
}
}
$a_foo = new Foo();
$user_method = array($a_foo, 'bar');
if (!function_exists($user_method))
die('You shouldn\'t see this :)');
$user_method('PHP'); // Should print "Hello PHP" ofcourse.
Furthermore the implementation of the user_method calling in
call_user_func is incorrect for referencing variabeles, which might be
pretty usefull. (see http://bugs.php.net/bug.php?id=17309)
--
Edit bug report at http://bugs.php.net/?id=18187&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18187&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18187&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18187&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18187&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18187&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18187&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18187&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18187&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18187&r=globals