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

eZUser::instance() always gives new instance of current user

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Medium Medium
    • None
    • 4.0.0
    • Misc
    • None
    • Operating System: Linux
      PHP Version: 5.2.0-8+etch11
      Database and version: MySQL 5.0.32

    Description

      When the instance method of the eZUser class is called with no parameters (like the currentUser method does), it creates a new instance of the current user and returns that, instead of returning an already created instance of it.
      This is because the check for it having been created already comes before the check that makes it use the current user when the ID is not given. The attached patch reverses this to check the parameter first, and the cache second.

      Steps to reproduce
      if (eZUser::currentUser()===eZUser::currentUser()) {
        echo "Same instance.";
      } else {
        echo "Not same instance.";
      }
      

      Attachments

        Activity

          People

            unknown unknown
            edorfaus edorfaus
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: