开发者

sfGuard custom algorithm_callable

I am trying to make custom algorithm for password hashing. I try to do this.

In app.cfg:

sf_guard_plugin:
  algorithm_callable: [Hlp, noHash]

In apps/frontend/lib/Hlp.php:

class Hlp
{
  function noHash($password) //tried to make public or public static, but it didn't work either
  {
    return $password;
  }
}

And in my database 'algorithm' is set to 'noHash'. When I try to log in I get follow开发者_高级运维ing error:

The algorithm callable "noHash" is not callable.

I am using php 5.2.

What am I doing wrong?

UPDATE Change in app.yml: algorithm_callable: 'Hlp::noHash'

Changed algorith in db to 'Hlp::noHash'

Marking hakre's answer as correct for providing useful tip.


The sfGuardPlugin 1.3 expects the function to be static in case you want to call a class member.

However in your case the error message explicitly states that you're calling a global public function, otherwise the error message would have been

The algorithm callable "Hlp::noHash" is not callable.

So check the settings. Check the PHP requirements. And if in doubt, read the source.


You should properly define your functions. Time to leave the PHP 4 era behind. Also, you need PHP >5.2.4

...
public static function noHash($password)
...

And you do mean app.yml right?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜