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