Re: Session variable not persisting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 18.03.13 19:46, schrieb Éric Oliver Paquette:
> Hi all, 
>
> I'll be swift in my explanation as I can't find in any way the source of the problem; it seems to be installation-related. 
>
> At execution, sometimes (randomly it seems at first), variable session aren't properly stored. 
>
> =====================
>
> First things first, about installation : 
>
> uname -a -m -p yields :
>
> Linux cl-t180-253cl.privatedns.com 2.6.18-308.1.1.el5 #1 SMP Wed Mar 7 04:16:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
>
> php -v yields :
>
> PHP 5.3.3 (cli) (built: Jun 27 2012 12:25:48) 
> Copyright (c) 1997-2010 The PHP Group
> Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
>
> =====================
>
> To make sure it is not caused by any other part of my scripts, I just created two scripts that have replicated the problem :
>
> SCRIPT #1 [ping.php] ################
>
> <?php
>
> session_start();
>
> if(count($_SESSION['in'])==0){
>     $_SESSION['in'][0]='0-initiate';
> } else {
>     $_SESSION['in'][] = count($_SESSION['in']).$_GET['push'];
> }
>
> if(count($_SESSION['in'])<1000){
>     $rand = rand(0, 1000000);
>     ?>
>         <meta http-equiv="refresh" content="0;URL='pong.php?push=<?php echo $rand; ?>'">
>     <?php
> } else {
>     var_dump($_SESSION);
> }
>
> ?>
>
> SCRIPT #2 [pong.php] ################ 
>
> <?php
>
> session_start();
>
> if(count($_SESSION['in'])==0){
>     $_SESSION['in'][0]='0-initiate';
> } else {
>     $_SESSION['in'][] = count($_SESSION['in']).$_GET['push'];
> }
>
> if(count($_SESSION['in'])<1000){
>     $rand = rand(0, 1000000);
>     ?>
>         <meta http-equiv="refresh" content="0;URL='ping.php?push=<?php echo $rand; ?>'">
>     <?php
> } else {
>     var_dump($_SESSION);
> }
>
> ?>
>
> ##################################
>
> In fact, when I run this on my server I randomly have empty entries in the $_SESSION array. Any thoughts on this? Is this a known bug (haven't found it…)
>
> Thanks!

Just a thought that came to my mind: Have you disabled browser caching?

And about the "push" is undefined in the logs: How do you call the
script for the first time? With or with push parameter?

-- 
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: marco@xxxxxxxxxx

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz


Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux