php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61191 $_SESSION['abfrage']++
Submitted: 2012-02-26 23:05 UTC Modified: 2012-02-27 20:51 UTC
From: phismail at web dot de Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.3.10 OS: Windows 7 64bit
Private report: No CVE-ID: None
 [2012-02-26 23:05 UTC] phismail at web dot de
Description:
------------
---
From manual page: http://www.php.net/reserved.variables.session
---
Everytime I reload my page the SESSION Variable increases by 2 instead of 1. register_globals is turned off! No changes made in php.ini

Modules mysql and other

PHP Version 3.5.1 (I'm too stupid to update)

I expect:
   1. I'm too stupid
   2. 64-bit CPU running a 32-bit Programm
   3. Script is loaded twice somehow

Test script:
---------------
// First test script in test2.php
session_start();

if(isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;
else
$_SESSION['views']=1;
echo "Views=". $_SESSION['views'];

// Second test script in test2.php
session_start();

$_SESSION['views']=$_SESSION['views']+2;

echo "Views=". $_SESSION['views'];

Expected result:
----------------
1 at first load
2 at second load
3 ...
4 ...

2 at first load
4 at second load
8 ...
12 ...

Actual result:
--------------
1 at first load
3 at second load
5 at third load
7 ...
9 ...

2 at first load
6 at second load
10 at third load
14 ...
18 ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-26 23:14 UTC] rasmus@php.net
-Status: Open +Status: Feedback
 [2012-02-26 23:14 UTC] rasmus@php.net
A bit of logging should clear it up. But one way this sometimes happens to people 
is when they configure their web server to redirect all 404s to a PHP script and 
on each page load the browser tries to load favicon.ico, but if it doesn't exist 
this request will trigger the 404 error script which in turn hits the session. So 
look for something like that.
 [2012-02-27 14:48 UTC] phismail at web dot de
-Status: Feedback +Status: Open
 [2012-02-27 14:48 UTC] phismail at web dot de
Your right! The script is loaded twice.

::1 - - [27/Feb/2012:15:19:25 +0100] "GET /taxilearn/training.php HTTP/1.1" 200 8 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2"
::1 - - [27/Feb/2012:15:19:25 +0100] "GET /taxilearn/training.php HTTP/1.1" 200 8 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2"

It seems to be a Firefox problem. The page is loaded twice at the same time. I.e. IE: 

::1 - - [27/Feb/2012:15:19:25 +0100] "GET /taxilearn/training.php HTTP/1.1" 200 8 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2"
::1 - - [27/Feb/2012:15:19:25 +0100] "GET /taxilearn/training.php HTTP/1.1" 200 8 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2"
::1 - - [27/Feb/2012:15:22:46 +0100] "GET /taxilearn/training.php HTTP/1.1" 200 7 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"
::1 - - [27/Feb/2012:15:22:47 +0100] "GET /favicon.ico HTTP/1.1" 200 1406 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"
::1 - - [27/Feb/2012:15:23:14 +0100] "GET /taxilearn/training.php HTTP/1.1" 200 7 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E)"

i never thought about that...sorry!
 [2012-02-27 15:12 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2012-02-27 17:10 UTC] phismail at web dot de
Solution: Deactivate Firebug in Firefox! -- Thx a lot
 [2012-02-27 20:51 UTC] cataphract@php.net
-Status: Closed +Status: Not a bug -Assigned To: laruence +Assigned To:
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC