#50289 [Opn->Bgs]: method_exists doesn't work on "self"

From: Date: Wed, 25 Nov 2009 07:52:39 +0000
Subject: #50289 [Opn->Bgs]: method_exists doesn't work on "self"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-145058@lists.php.net to get a copy of this message
ID: 50289 Updated by: jani@php.net Reported By: soapergem at gmail dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows XP PHP Version: 5.3.1 New Comment: callback != object or class name There is no bug here. Previous Comments: ------------------------------------------------------------------------ [2009-11-24 21:37:28] soapergem at gmail dot com Description: ------------ method_exists doesn't work if you pass in a callback with a reference to "self". Yet call_user_func *does* work if you pass in a callback with a reference to "self". This is inconsistent and probably not intentional. Reproduce code: --------------- <?php class Test { public static function check_method() { var_dump(method_exists('self', 'output')); } public static function run_method() { call_user_func(array('self', 'output')); } public static function output() { echo 'this works'; } } Test::check_method(); Test::run_method(); ?> Expected result: ---------------- bool(true) this works Actual result: -------------- bool(false) this works ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50289&edit=1

« previous php.bugs (#145058) next »