public function actionLaunch()
{
return $this->redirect(['site/index']);
}
public function actionIndex()
{
if(!empty($_SESSION['basic']))
$_SESSION['basic']++;
else
$_SESSION['basic']= 1;
echo $_SESSION['basic'];
}
Session will be incremented by one while redirect
which mean the action is executed once
Session will be incremented by two ( not always )
which mean the action is executed twice
| Q | A
| ---------------- | ---
| Yii version | 2.0.14.2
| PHP version | 7.0
| Operating system | windows
Who is calling actionLaunch? Maybe is the caller making two time the same call?
Thank you for your question.
In order for this issue tracker to be effective, it should only contain bug reports and feature requests.
We advise you to use our community driven resources:
If you are confident that there is a bug in the framework, feel free to provide information on how to reproduce it. This issue will be closed for now.
_This is an automated comment, triggered by adding the label question._
@FabrizioCaldarelli
we are calling the launch action manually in the browser.
@samdark
we have test it in different cases and it's still reproducible
Thanks.
Are you clearing the sessions between each test so it's reset?
@mmezzawi are you testing it on Google Chrome?
I faced something similar to this case. But I realized that the problem is caused by Google Chrome.
It only happens when I enter the url manually in the address bar.
I suspect that Google Chrome launch a anticipated request while you are typing the address.
Try Firefox. It's the only browser that behaves strictly according to standards nowadays. If it doesn't work in FF then it's something in Yii. If it does and it's a Chrome thing then I'm not surprised. The way it maintains sessions when closing-opening browser is totally against standards but well, it is how it is.
@berosoboy , @samdark
The issue is only occurring on google chrome, another request is made without been logged in the dev tools , i have used wireshark to monitor this behavior.
The following issue https://bugs.chromium.org/p/chromium/issues/detail?id=64810 and other issue related to the same topic were reported but none has a solution.
Any advice about this ?
Thanks in advance
I suspect that is caused by one of these Chrome default settings:

My only advice is to not rely on GET method if you want to change sensitive data in your application.
Dear @berosoboy ,
That right seems those two features are responsible of this issue.
Currently the issue appear while redirecting to another action ( note no params are sent )
Thanks.
I guess that the issue will happen regardless of redirection.
Since it's Chrome issue and not Yii issue, closing.
@samdark @berosoboy,
Appreciated !!!
You're welcome ;)