0
votes

I am facing this error when running my code I can't understand the error of that thing, any advices ?

Strict Standards: Only variables should be passed by reference in /home/kea/newalarab/comments/comments/src/Comments/Comments.php on line 552

Strict Standards: Only variables should be passed by reference in /home/kea/newalarab/comments/comments/src/Comments/Comments.php on line 563

    public function authUser($attribute = null)
{
    return reset($this['events']->fire('auth.user', $attribute)); //line 552
}

public function adminCheck()
{
    return reset($this['events']->fire('admin.check')) === true; //line 563
}
1
Put 'auth.user' and 'admin.check' into variables and pass these variables to function fire(), because fire() is probably declared as fire(&$par, $attr)Agnius Vasiliauskas

1 Answers

2
votes

You'll probably find that reset() is defined as something like...

reset( &$value ) {}

Which is expecting the value to be passed by reference. When you call this, you need to pass an actual variable as opposed to directly passing in the return value from a function. So...

public function authUser($attribute = null)
{
    $value = $this['events']->fire('auth.user', $attribute);
    return reset($value); //line 552
}

public function adminCheck()
{
    $value = $this['events']->fire('admin.check');
    return reset($value) === true; //line 563
}

This could also be a result of fire() being declared in a similar manner, you need to work out which one is causing the problem and amend as above.