yiisoft/yii2-twig

Trying to get property of non-object after upgrade from 2.0.4 to 2.0.5

schmunk42 opened this issue · 1 comments

What steps will reproduce the problem?

I am using this widget in our projects: https://github.com/dmstr/yii2-prototype-module/blob/master/src/widgets/TwigWidget.php

What's expected?

No error.

What do you get instead?

PHP Notice – yii\base\ErrorException

Trying to get property of non-object

Error is thrown here: https://github.com/yiisoft/yii2-twig/blame/397e711da9aae8b813778e3504b23d80fb1a86f2/ViewRenderer.php#L169

Looks like my $view is empty, this should be checked here or as an alternative we could pass the whole view to the method and check it in the fallback method.

Additional info

Q A
Yii vesion 2.0.9
PHP version 7.0.8
Operating system Debian (Docker)

Yes, there should be a check for object existence. Could you send a pull request?