At the time of your Zend_Auth::hasIdentity() call the Auth object must have
a reference to the correct Zend_Auth_Storage object (presumably a
Zend_Auth_Storage_Session) and this object must be able to access the actual
storage. ($_SESSION['Zend_Auth']['storage'])
Are you sure this is the case?
Hope this helps.
Eric
----- Original Message -----
From: "Juan Felipe Alavarez Saldarriaga" <[EMAIL PROTECTED]>
To: "Aissam Bazzaoui" <[EMAIL PROTECTED]>
Cc: "fw-general" <[email protected]>
Sent: Wednesday, October 03, 2007 10:15 PM
Subject: [fw-general] Re: RE : [fw-general] Zend_AUth::getInstance issue
Well, I try that before and doesn't work, look what I got:
echo "<hr>Before hasIdentity!";
// If we have an user authenticated.
if ( $objAuth->hasIdentity() )
{
echo "<hr>Inside the if hasIdentity!";
And look what I got when I look for the echoes:
Before hasIdentity!
The echo inside the if() is never printed. Seems like when I try to execute
some method from the Zend_Auth class I can't.
Thx for any help.
----- Original Message -----
From: "Aissam Bazzaoui" <[EMAIL PROTECTED]>
To: "Juan Felipe Alavarez Saldarriaga" <[EMAIL PROTECTED]>, "fw-general"
<[email protected]>
Sent: miércoles 3 de octubre de 2007 15H01 (GMT-0500) America/Bogota
Subject: RE : [fw-general] Zend_AUth::getInstance issue
check identity before getting it :
if ($objAuth->hasIdentity())
it's on manual
http://framework.zend.com/manual/en/zend.auth.html
;)
--- Juan Felipe Alavarez Saldarriaga
<[EMAIL PROTECTED]> a écrit :
:)
I got this issue, I have a plugin named
TemplatePlugin, this plugin injects the current view
into a template add by myself, in the
dispatchLoopShutdown method from the plugin I have
this code:
// Get Zend Auth Instance
$objAuth = Zend_Auth::getInstance();
So then I make this:
// Get user fields
$objUser = $objAuth->getIdentity();
// Set user name to show in template
$objView->usrName = $objUser->first_name . " " .
$objUser->last_name;
So, what's the issue ? If the user is not logged in
via Zend_Auth the value the Zend_Auth have no data,
but when I try to execute the getIdentity method
from the Zend_Auth class the process is stoped.
This is the return from the Zend_Auth::getInstance()
method:
objAuth:
Zend_Auth Object
(
[_storage:protected] =>
)
So I was trying to execute getIdentity method from
the Zend_Auth class and when I do that the process
stop, I guess is because I don't have anything to
do, I try to use the getStorage method and the same,
the process stop when I execute one of the methods
from the Zend_Auth.
Is there a way to validate the existence of the
Zend_Auth method ?
Thx for any help.