Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response object on controller set to string since 2.0.36 #18172

Closed
julianrutten opened this issue Jul 13, 2020 · 2 comments
Closed

Response object on controller set to string since 2.0.36 #18172

julianrutten opened this issue Jul 13, 2020 · 2 comments

Comments

@julianrutten
Copy link

What steps will reproduce the problem?

Unsure, for me it is just $this->redirect() in a \yii\web\Controller instance. Since 2.0.36. If this is not a known issue (since it was just introduced) let me know I will dig some to see if there is a unique use-case going on here but I don't think so.

What is the expected result?

302 redirect

What do you get instead?

Call to a member function redirect() on string
Line 242 of vendor/yiisoft/yii2/web/Controller.php:
return $this->response->redirect(Url::to($url), $statusCode)

Additional info

I can see this object was introduced in 2.0.36. See #18083

Q A
Yii version 2.0.36
PHP version 7.3.19
Operating system Ubuntu 20.04
@darkdef
Copy link
Contributor

darkdef commented Jul 13, 2020

if you have function init() in your controller - read https://github.com/yiisoft/yii2/blob/master/framework/UPGRADE.md

If you have any controllers that override the init() method, make sure they are calling parent::init() at the beginning, as demonstrated in the component guide.

@julianrutten
Copy link
Author

My bad! Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants