S
S
Sergey Beloventsev2016-07-09 21:15:01
Yii
Sergey Beloventsev, 2016-07-09 21:15:01

Why does it appear in the title “Error (#16)”?

I copied the project from windows to ubuntu It seems that I connected everything as it should, but at startup it falls out in the title Error (# 16) and a blank screen, what is this error and why does it pop up, do not tell me?
Here is the error in the logs.

[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

Here are 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
        ]);
    }
}

and I don't understand what's wrong

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
polar-bear, 2016-07-09
@Sergalas

Replace:
with
or
if(!Yii::$app->user->isGuest) {

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question