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

Closed
schmunk42 opened this Issue Sep 15, 2016 · 1 comment

Projects

None yet

2 participants

@schmunk42
Contributor

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)
@schmunk42 schmunk42 added a commit to dmstr/yii2-prototype-module that referenced this issue Sep 15, 2016
@schmunk42 schmunk42 added conflicting version for yii2-twig aa8829d
@samdark samdark added the bug label Sep 15, 2016
@samdark
Member
samdark commented Sep 15, 2016

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

@samdark samdark self-assigned this Sep 15, 2016
@Quexer69 Quexer69 added a commit to Quexer69/yii2-twig that referenced this issue Sep 21, 2016
@Quexer69 Quexer69 Fixes #61, check object existence c5d10ad
@samdark samdark closed this in 02ae886 Sep 21, 2016
@samdark samdark added this to the 2.1.0 milestone Sep 21, 2016
@U-D13 U-D13 pushed a commit to U-D13/yii2-twig that referenced this issue Dec 2, 2016
@Quexer69 @samdark Quexer69 + samdark Fixes #61: Added missing view object existence check 21dec6a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment