This is something really weird. I have the following page structure:
index.php
<?php
session_start();
include_once('src/functions.php');
logMe('index');
include_once(TEMPLATES_FOLDER . 'standard/header.php');
[...]
include_once(TEMPLATES_FOLDER . 'standard/footer.php');
?>
header.php
<?php logMe('header'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
[...]
<?php if (isset($_SESSION['accountId'])) : ?>
<script type="text/javascript">
[...]
</script>
<?php endif; ?>
</head>
<body>
[...]
I'm expecting to get 2 log rows, one from index.php
and one from header.php
(beacuse of the logMe()
function).
Now, if I run the page in Firefox (61.0.2), i get 4 logs. If I run it in Chrome (68.0.3440.106), i get 2 logs. So in Firefox it seems it is executing everything twice.
What is even more weird is that if i remove the <script>
tag, the problem seems to disappear as Firefox logs only 2 rows. But even if I put back an empty <script>
tag, it logs 4 rows! So the key of the problem seems to be this <script>
tag, but how can it be??
Moreover, I have a <script>
tag also in the footer.php
. I then expect to obtain 6 log rows following this behaviour, but I always get only 4. Only if I remove them both (from header and footer) I get the correct behaviour (2 logs).
Does anybody know what is happening?
update
As per raina77ow request, this is the access.log
differences:
So Firefox is effectively requesting ?pageId=0
twice.
Ok, it seems something got spoiled in my Firefox installation. I tried starting it in safe mode and the problem didn't show. So I made an hard reset on it and now the problem doesn't show anymore.
Still can't think of any connection between the problem and the <script>
tag anyway...