Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 954355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:12:12+00:00 2026-05-16T00:12:12+00:00

i am having difficulties creating my own Zend_Auth_Adapter. i am using Doctrine 2 with

  • 0

i am having difficulties creating my own Zend_Auth_Adapter. i am using Doctrine 2 with it also. so far i have … code below

i am getting the error

Method “hasIdentity” does not exist and was not trapped in __call()

whats wrong?

use \Doctrine\ORM;
class Application_Auth_Adapter implements Zend_Auth_Adapter_Interface {
    private $username;
    private $password;

    function __construct($username, $password) {
        $this->username = $username;
        $this->password = $password;
    }

    function authenticate() {
        $em = Zend_Registry::get('em');
        $query = $em->createQuery('select u from Application\Entities\User u WHERE u.name = :username')
                    ->setParameter('username', $this->username);
        try {
            $user = $query->getSingleResult();
            $salt = $user->salt;
            $hashedPassword = hash_hmac('sha256', $this->password, $salt);
            if ($hashedPassword == $user->password) {
                // login success
                return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $user);
            } else {
                // wrong password
                return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, null);
            }
        } catch (NonUniqueResultException $e) {
            // non unique result
            return new Zend_Auth_Result(Zend_Auth_Result::FAILURE, null);
        } catch (NoResultException $e) {
            // no result found
            return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, null);
        } catch (Exception $e) {
            // exception occured
            return new Zend_Auth_Result(Zend_Auth_Result::FAILURE, null);
        }
    }
} 

UPDATE

i noticed that the problem comes from abt line 123 of Zend_Auth

if ($this->hasIdentity()) {
    $this->clearIdentity();
}

but just below that function, authenticate(), its

public function hasIdentity()

i noticed something strange with teh stack trace

#0 [internal function]: Zend_Controller_Action->__call('hasIdentity', Array)
#1 D:\ResourceLibrary\Frameworks\ZendFramework\library\Zend\Auth.php(123): AuthController->hasIdentity()
#2 D:\Projects\Websites\php\ZendFramework\LearningZF\application\controllers\AuthController.php(23): Zend_Auth->authenticate(Object(Application_Auth_Adapter))
#3 D:\ResourceLibrary\Frameworks\ZendFramework\library\Zend\Controller\Action.php(513): AuthController->loginAction()
#4 D:\ResourceLibrary\Frameworks\ZendFramework\library\Zend\Controller\Dispatcher\Standard.php(295): Zend_Controller_Action->dispatch('loginAction')
#5 D:\ResourceLibrary\Frameworks\ZendFramework\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#6 D:\ResourceLibrary\Frameworks\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#7 D:\ResourceLibrary\Frameworks\ZendFramework\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#8 D:\Projects\Websites\php\ZendFramework\LearningZF\public\index.php(26): Zend_Application->run()
#9 {main}

see AuthController->hasIdentity() its trying to call hasIdentity() from AuthController!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:12:13+00:00Added an answer on May 16, 2026 at 12:12 am

    i found out why! see my update … the stack trace. i am calling a method as if it were static. wont that produce an error? anyways … i shld be doing

    $result = Zend_Auth::getInstance()->authenticate($adapter);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a problem getting a TreeView control to display node images. The code below
I'm having some difficulties creating a sum from values I have in a collection.
I'm having difficulties closing an email message that I have raised. The email opens
i'm trying to set up the selenium-maven-plugin and having some difficulties i hope somebody
Having worked with Classic ASP for about 2 years now by creating a few
Having this route: map.foo 'foo/*path', :controller => 'foo', :action => 'index' I have the
having difficulties because of my noobness, again. I dont know if I am doing
I am having difficulties figuring out what is causing wierd characters to appear in
I'm having difficulties implementing a generic 'map' function over arrays. I started with the
I'm having difficulties to understand exactly WHEN autorelease pools are created and released in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.