Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-11253

Log in a user with method loginCurrent doesn't update global user cache

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 3.10.0
    • 3.10.0alpha1, 3.8.8, 3.9.2
    • None
    • n/a

    Description

      After an ezuser has been instanciated, the dynamic method loginCurrent() ( http://pubsvn.ez.no/doxygen/3.8/html/classeZUser.html#4c1268d7a92e4e244be6b6199dd38bcb )allows to directly login the user.

      But once the login done, global cache informations about logged in user aren't updated correctly, which doesn't let know the system about the new logged in user. The reproduce step confirms the lack.
      As the variable cache, if existant, will be used to fetch the logged in user ( cf eZuser::instance() ), the returned information is then wrong, it becomes impossible to fetch the current user in the current process, unless we manually unset the variable $GLOBALS["eZUserGlobalInstance_"] .

      The method setCurrentlyLoggedInUser seems to do the job, but isn't used in the method (as it can be done in method loginUser). I then guess that it should be called on login ( a patch is attached , against 3.9.2 ).

      Steps to reproduce

      Try this script to reproduce and see:

      // We consider that we're not logged in, the current user is then set to "anonymous":
      var_dump( eZUser::currentUser() );
      // We fetch a user and log him in
      $user = eZUser::fetch( $someUserID );
      $user->loginCurrent();
      // The user should have been logged in,
      //  but as user cache hasn't been updated, we can't retrieve the information
      var_dump( eZUser::currentUser() );
      // This should still fetch anonymous user, which is not right any more
      

      Attachments

        Activity

          People

            br br
            alexandre.nion alexandre.nion
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: