I have a problem which I can't understand.
The problem occurs only on Opera 11.50 browser. I have simply write to file function.
fopen, LOCK_EX, fputs, LOCK_UN, fclose
.
When I normally open pages, everything is ok. But when I reload page, then string is write to file multiple times (2, sometimes 3). I checked, Function is fired only once, and echo return correct string.
Also on refresh, Opera ignores php session variable and cookies. Of course I use buffer before session start.
For any other browser, this problems does not occur.
I checked the cookies and browser settings. Also reinstalled browser. On the second PC with freshly downloaded and installed opera 11.50 is the same problem.
Any ideas?
ps: I read this related topic, but I have not found the answer for my problem there.
There is some code:
if (!isset($_SESSION['foo']) && ($check4 === false) && !isset($_COOKIE['bar'])) {
echo "test!";
$fileHandler = fopen(MASTER_PATH . "/data/logs/loger.txt", "ab");
flock($fileHandler, LOCK_EX);
fputs($fileHandler, "What?!");
flock($fileHandler, LOCK_UN);
fclose($fileHandler);
$_SESSION['foo'] = true;
$check4 = true;
setcookie("bar");
}
When normally enter page everything is ok. When reload echo "test!" isn't run, but in the file appear two entries "What?!". Only this function has output to that file.