Почему возникает в тайтле “Ошибка (#16)”?

Скопировал проект с windows на ubuntu Вроде подключил все как должно но при запуске вываливается в тайтле Ошибка (#16) и чистый экран что это за ошибка и почему выскакивает не подскажите ?
Вот ошибка в логах.

[Sat Jul 09 22:10:57.555546 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP Notice:  Trying to get property of non-object in /var/www/film.lc/common/widgets/header/Menus.php on line 22
[Sat Jul 09 22:10:57.555562 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP Stack trace:
[Sat Jul 09 22:10:57.555569 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP   1. yii\\base\\ErrorHandler->handleFatalError() /var/www/film.lc/vendor/yiisoft/yii2/base/ErrorHandler.php:0
[Sat Jul 09 22:10:57.555574 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP   2. yii\\web\\ErrorHandler->renderException() /var/www/film.lc/vendor/yiisoft/yii2/base/ErrorHandler.php:244
[Sat Jul 09 22:10:57.555578 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP   3. yii\\base\\Module->runAction() /var/www/film.lc/vendor/yiisoft/yii2/web/ErrorHandler.php:93
[Sat Jul 09 22:10:57.555582 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP   4. yii\\base\\Controller->runAction() /var/www/film.lc/vendor/yiisoft/yii2/base/Module.php:454
[Sat Jul 09 22:10:57.555586 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP   5. yii\\base\\Action->runWithParams() /var/www/film.lc/vendor/yiisoft/yii2/base/Controller.php:154
[Sat Jul 09 22:10:57.555590 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP   6. call_user_func_array:{/var/www/film.lc/vendor/yiisoft/yii2/base/Action.php:92}() /var/www/film.lc/vendor/yiisoft/yii2/base/Action.php:92
[Sat Jul 09 22:10:57.555594 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP   7. yii\\web\\ErrorAction->run() /var/www/film.lc/vendor/yiisoft/yii2/base/Action.php:92
[Sat Jul 09 22:10:57.555598 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP   8. yii\\base\\Controller->render() /var/www/film.lc/vendor/yiisoft/yii2/web/ErrorAction.php:108
[Sat Jul 09 22:10:57.555602 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP   9. yii\\base\\Controller->renderContent() /var/www/film.lc/vendor/yiisoft/yii2/base/Controller.php:378
[Sat Jul 09 22:10:57.555606 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP  10. yii\\base\\View->renderFile() /var/www/film.lc/vendor/yiisoft/yii2/base/Controller.php:392
[Sat Jul 09 22:10:57.555609 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP  11. yii\\base\\View->renderPhpFile() /var/www/film.lc/vendor/yiisoft/yii2/base/View.php:247
[Sat Jul 09 22:10:57.555613 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP  12. require() /var/www/film.lc/vendor/yiisoft/yii2/base/View.php:325
[Sat Jul 09 22:10:57.555617 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP  13. yii\\base\\Widget::widget() /var/www/film.lc/frontend/views/layouts/main.php:27
[Sat Jul 09 22:10:57.555630 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP  14. common\\widgets\\header\\Menus->run() /var/www/film.lc/vendor/yiisoft/yii2/base/Widget.php:98
[Sat Jul 09 22:10:57.556813 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP Parse error:  syntax error, unexpected '}', expecting end of file in /var/www/film.lc/common/widgets/header/views/html.php on line 162
[Sat Jul 09 22:10:57.556843 2016] [:error] [pid 14918] [client 127.0.0.1:53566] PHP Fatal error:  Exception thrown without a stack frame in Unknown on line 0


Вот Menus

<?php namespace common\widgets\header;
use frontend\widget\comment\Comment;
use Yii;
use yii\base\Widget;
use common\models\Category;
use common\models\Image;
use common\models\Commet;
use common\models\Sites;
use yii\helpers\ArrayHelper;
class Menus extends Widget{
    public $menu;
    public function init()
    {
        parent::init();

    }
    public function run()
    {
        $comments=Commet::find()->orderBy(['created_at'=> SORT_DESC])->limit(20)->all();
        $cat=Category::find()->select(['id','name_category','slug_category'])->where('tags=0')->all();
        $img=Image::find()->select(['path','name'])->where('logo=1')->one();
        if(Yii::$app->user->identity->id != null) {
            $avatar = Image::find()->select(['path', 'name'])->where(['id_user' => Yii::$app->user->identity->id])->one();
        }else{
            $avatar= false;
        }
        $sites=Sites::findOne(1);
        $categorypages=Category::findOne($sites->cat_for_footer);
        return $this->render('html',[
            'cat'           =>  $cat,
            'img'           =>  $img,
            //'avatar'        =>  $avatar,
            'comments'      =>  $comments,
            'categorypages' =>  $categorypages
        ]);
    }
}


и не пойму в чем ошибка
  • Вопрос задан
  • 106 просмотров
Решения вопроса 1
@polar-bear
Замените:
if(Yii::$app->user->identity->id != null) {
на
if(Yii::$app->user->id !== null) {
или
if(!Yii::$app->user->isGuest) {
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы