Development

#1626 (sfGuardUserProfile bug in getProfile())

You must first sign up to be able to contribute.

Ticket #1626 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

sfGuardUserProfile bug in getProfile()

Reported by: Laurent.Marchal Assigned to: fabien
Priority: minor Milestone:
Component: sfGuardPlugin Version: 1.0.0
Keywords: sfGuardUserProfile getProfile Cc:
Qualification:

Description

When deleting sfGuardPlugin user you get an exception raised saying

The user profile class "sfGuardUserProfile" does not exist.
stack trace

* at ()
in SF_ROOT_DIR/plugins/sfGuardPlugin/lib/model/sfGuardUser.php line 84 ...
81. $profileClass = sfConfig::get('app_sf_guard_plugin_profile_class', 'sfGuardUserProfile');
82. if (!class_exists($profileClass))
83. {
84. throw new sfException(sprintf('The user profile class "%s" does not exist.', $profileClass));
85. }
86.
87. $fieldName = sfConfig::get('app_sf_guard_plugin_profile_field_name', 'user_id');

This is caused by plugins/sfGuardPlugin/lib/model/sfGuardUser.php:251

    if ($profile = $this->getProfile())
    {
      $profile->delete();
    }

 public function getProfile()
  {
    if (null === $this->profile)
    {
      $profileClass = sfConfig::get('app_sf_guard_plugin_profile_class', 'sfGuardUserProfile');
      if (!class_exists($profileClass))
      {
        throw new sfException(sprintf('The user profile class "%s" does not exist.', $profileClass));
      }

The getProfile() function should only delete profile if exist, by default the profile is not used in the sfGuardPlugin, so getProfile() must not raise exception if the profile is not used.

Change History

04/02/07 13:19:51 changed by fabien

  • milestone deleted.

04/02/07 13:26:07 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [3693]) plugins: fixed deleting sfGuardUser when no profile is defined (closes #1626)