As weird as it sounds, I have a problem with sessions that occur only under Chrome.
Here is the scenario:
I have a method search
in the controller:
public function search()
{
$keyWord = htmlspecialchars(strip_tags($this->get['keyword']));
if(mb_strlen($keyWord) < 3){
$this->flashMessage->warning('keyword is too short');
redirect(SITE_ADDR . '/forum');
}
......
}
Plain and simple - if the keyword from $_GET is less than 3 characters - save a message in $_SESSION and redirect. However if I go to the search page (eg. site.com/forum/search/?keyword=fff
) (note there are 3 characters in $_GET) and start refreshing really quick, the error message is randomly set BUT the redirect function is never called. I tried stopping the script by inserting exit();
right after $this->flashMessage->warning
and the script was stopped with no problems but the redirect function is never called. For 1 or 2 characters, there is no problem with the redirect. Only for 3 and more characters when the error message is not even supposed to be set in a session.
This only happens in Chrome. I tried Firefox and Opera and there was no such problem. I tried in incognito but nothing changed. Anyone has any idea why is this happening?
I am not using a framework or anything.