Hacking around so much I forget what I've done so far.

So now the problem is that I can not log out.

Okay, so if I edit the file sfGuardUserSecurity.class.php and add in
this echo and die statement:

  public function signOut()
  {
    $this->getAttributeHolder()->removeNamespace
('sfGuardSecurityUser');
    $this->user = null;
    $this->clearCredentials();
    $this->setAuthenticated(false);
echo " is authenticated: ";
echo $this->isAuthenticated();
die();

    $expiration_age = sfConfig::get
('app_sf_guard_plugin_remember_key_expiration_age', 15 * 24 * 3600);
    $remember_cookie = sfConfig::get
('app_sf_guard_plugin_remember_cookie_name', 'sfRemember');
    sfContext::getInstance()->getResponse()->setCookie
($remember_cookie, '', time() - $expiration_age);
  }

Then I point my browser at sfGuardAuth/signout. I get a blank white
screen, except for the words " is authenticated ". So I know the
method is being called, and I know that, at that point, I am not
authenticated. But if I take out those 3 lines and go to the front
page of the site, I see the results of this code, which I've put in
layout.php:

<?php echo " user is authenticated: " . $sf_user->isAuthenticated() ?>

which always results in:

user is authenticated: 1

So I get un-authenticated, but then something authenticates me again
before the page renders.

And yes, before anyone suggests it, I'm running "symfony cc" after
almost every change that I make.








On Sep 19, 12:14 am, Jake Barnes <lkrub...@geocities.com> wrote:
> The following code always works for me. I can go to the front page of
> the site, and I can log in and I never get an error.
>
> For one of my clients, the site works great in FireFox, but throws an
> error in Google Chrome. For another of my clients, the following code
> dies with a fatal error all the time. The error is that the method
> "getId()" is being called on either a non-existent object, or an
> object without that method. In other words, this line throws a fatal
> error:
>
> $sf_user->getGuardUser()->getId()
>
> This code appears in layout.php.
>
> Here is the code:
>
> <?php if(isset($sf_user)): ?>
>
>   <?php if($sf_user->isAuthenticated()): ?>
>
>     <?php $criteriaToFindProfile = new Criteria();
> $criteriaToFindProfile->add(sfGuardUserProfilePeer::USER_ID, 
> $sf_user->getGuardUser()->getId()); $thisUsersProfile =
>
> sfGuardUserProfilePeer::doSelectOne($criteriaToFindProfile); ?>
>
>     <?php if (@ is_object($thisUsersProfile)): $username =
> $thisUsersProfile->getFirstName()." "; $username .= $thisUsersProfile-
>
> >getLastName(); if (!$username) $username = $thisUsersProfile-
> >getsfGuardUser()->getUsername(); endif; ?>
>
>     <?php if (@ is_object($thisUsersProfile)): ?><p>Hello, <a
> id="userid" href="<?php echo url_for('content/profile?id='.
> $thisUsersProfile->getId()) ?>"><?php echo $username ?>!</a></p><?php
> endif ?>
>     <a href="<?php echo url_for("sfGuardAuth/signout") ?>"><img src="<?
> php echo image_path('logout.png') ?>" alt="LOGOUT" /></a>
>
>   <?php endif; ?>
>
> <?php endif; ?>
>
> Can anyone think why this would behave differently on different
> people's browsers?
>
> I'm having trouble fixing this bug, because I can not recreate it on
> my own machine.
>
> What is really bizarre is that my clients browser somehow got past
> this line:
>
>  <?php if($sf_user->isAuthenticated()): ?>
>
> Since the page always died for them with a fatal error, they had no
> way to log in.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to