Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
has_access throws a warning when session times out.
  • In my template controller I setup some orm auth permissions into an array that I use all over the place.

    The problem is when the session times out, and you try to load a page. you get a warning.

    Fuel\Core\PhpErrorException [ Warning ]:
    reset() expects parameter 1 to be array, boolean given

    PKGPATH/auth/classes/auth/login/ormauth.php @ line 643

  • /**
    * Extension of base driver method to default to user group instead of user id
    */
    public function has_access($condition, $driver = null, $user = null)
    {
    if (is_null($user))
    {
    $groups = $this->get_groups();
    $user = reset($groups);     //Line 643
    }
    return parent::has_access($condition, $driver, $user);
    }
  • get_groups is returning false.

    I am thinking of just wrapping it in a is_array();

    Comments?


  • You don't have the guest user enabled?
  • No.  I actually removed the guest user.  Is that the problem?
  • HarroHarro
    Accepted Answer
    Yes.

    Technically, if you have disabled the guest user support in the config, you can remove the guest user.

    However, any method that is user related, expects a user to be there. And that includes has_access. You can not say "does the current user have access to this page" if no current user is defined. This is the main purpose of the guest user, it represents "the public" or "the visitor", the anonymous guest.

    If you don't have a guest user, you need to do an Auth::check() to make sure you have a valid user before you check any of the users properties, including rights.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion