PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Authentication » Auth » Bug #4242

$loginFunction cannot be a method

Details

Submitted2005-04-28 15:34 UTC
Frombenblay at gmail dot com
StatusBogus
PackageAuth
PHP Version4.2.2
OSLinux
Roadmaps(Not assigned)

Comments

[2005-04-28 15:34 UTC] benblay at gmail dot com

Description:
------------
When using a user-defined login function, it would appear that Auth fails to recognize methods as $loginFunction. Using a simple function name works fine, but using object->method to specify the function fails.

Reproduce code:
---------------
$security = new Auth('DB',$params,'main->loginForm');

Expected result:
----------------
$main->loginForm() is executed in place of default login form.

Actual result:
--------------
Auth ignores the method and uses the default login function instead.

[2005-10-25 15:03 UTC] derekd at pmtads dot com

I'm not sure this is a bug. The PEAR libraries use is_callable() to determine if the $loginFunction exists. To path a method as the $loginFunction, try this:
$main = new Main();
$security = new Auth("DB",$params, array($main, 'loginForm'));

[2005-10-25 16:42 UTC] benblay at gmail dot com

Tested using array to call class and method and worked as described. Thank you.