i have a problem after ((Controller::$request and $response)) change
in beforeAction when we print (( $this->validateCsrfToken() )) it returns : 'request' not an object
it seems $this->validateCsrfToken() has not the same value as Yii::$app->getRequest()->validateCsrfToken()
and this problem stops my controllers
please resolve this
| Q | A
| ---------------- | ---
| Yii version | 2.0.15
| PHP version | 7.2
| Operating system | centos
Can you confirm which version you are on?
Latest Yii2 is 2.0.35 which is 20 releases ahead of the one you listed.
If you are on .15 can you update to .35 and test again.
Can you confirm which version you are on?
Latest Yii2 is 2.0.35 which is 20 releases ahead of the one you listed.If you are on .15 can you update to .35 and test again.
updated to .35 but still the same error
Would you please provide full error message including file, line and stracktrace?
Would you please provide full error message including file, line and stracktrace?
Do you have an init();
in your SiteController
?
If so you need to call parent::init();
Do you have an
init();
in yourSiteController
?If so you need to call
parent::init();
true, it seems solved
thanks
I have the same issue, but my SiteController doesn't have an init();
I'm running Yii2 version 2.0.36
Is there another way to solve this issue or do I need to add an init();
function and call parent::init();
in there?
Does your SiteController
extend from another custom Controller
class?
Yes. I have just found what my issue was. Thank you.
Do you have an
init();
in yourSiteController
?If so you need to call
parent::init();
I upgraded from 2.015 to 2.0.35 and also had this problem
Thanks, that solves my problem
I upgraded from 2.015
to 2.0.35
and also had this problem
Also i tried to call the method init()
and and it doesn't work either(
Can anyone help me?
Please use the Forum if you have any questions.
Most helpful comment
Do you have an
init();
in yourSiteController
?If so you need to call
parent::init();