简体   繁体   中英

**Strict Standards Only variables should be passed by reference

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
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM