#15983 [Opn->Fbk]: session variables lost between pages

From: Date: Thu, 29 Aug 2002 20:30:18 +0000
Subject: #15983 [Opn->Fbk]: session variables lost between pages
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18179@lists.php.net to get a copy of this message
 ID:               15983
 Updated by:       kalowsky@php.net
 Reported By:      sl@scrooge.dk
-Status:           Open
+Status:           Feedback
 Bug Type:         Session related
 Operating System: Debian/Linux mips platform
 PHP Version:      4.1.2 and 4.2.0
 New Comment:

The problem with the suggested work around is fairly straight forward.

from the ext/session/config.m4:
if test "$PHP_SESSION" != "no"; then
  AC_CHECK_FUNCS(pread pwrite)

This asks libtool/autoconf to check the system for the functions pread
and pwrite.  If they are found by libtool/autoconf (mostly autoconf),
the HAVE_PREAD and HAVE_PWRITE flags are set.  If your work around is
actually working, it would suggest to me that pread doesn't work
properly on this non-i386 machines.  

Is there any chance you can look into the pread/pwrite functionality of
these non-i386 machines?


Previous Comments:
------------------------------------------------------------------------

[2002-08-29 12:14:29] neuj60@yahoo.de

Look at these examples, refresh the same file:

Example 1 works fine:
---------
<?php
GLOBAL $HTTP_SESSION_VARS;
session_start();
;session_register('AVAR');
$HTTP_SESSION_VARS['AVAR'] += 1;
print "<p>variable={$HTTP_SESSION_VARS['AVAR']}</p>";
?>

Example 2 doesn't work correctly:
---------
prints always "count=1" and thats stored in the session file:
<?php
session_start();
GLOBAL $count;
session_register("count");
$count++;
print "<p>count=$count</p>";
$count=10;
?>

For scalars Ex. 1 would be ok, but how to deal with objects?

I'm using PHP 4.2.2 (same was with 4.2.1) on Windows2000.

------------------------------------------------------------------------

[2002-08-29 11:34:19] pratesi@telug.it

RH 7.3 on i386???
Noooo.... do you have enabled cookies? :-)

Apart from joking, the problem we are mentioning
seems to be strictly related to non-i386 platforms,
while I do not have any problem on both Debian Woody
and RH 7.3, both with PHP 4.1 and 4.2.
I have problems only on PPC (I still haven't had time
to test on Debian Sparc, I should try in september),
but the workaround that I have mentioned seems to be
correctly working since from many days on my new server :-)

BTW, the workaround that I'm using corresponds to using
the same code that it was used in PHP 4.0 and that worked
for me also on Debian Sparc and on Linux PPC.

------------------------------------------------------------------------

[2002-08-28 13:07:51] kt@mconline.dk

Im using RH7.3 - PHP 4.1.2 and i have all the mentioned symptoms.

When using header for redir i seem to loose the session vars.

I seem to be stuck here 

Looking forward to hear any suggestions :)

Regards,

Kristian

------------------------------------------------------------------------

[2002-08-27 11:33:21] niimai@tiscali.it

It seems that also on WinXP, when I do redirects between pages, I
experience the same problem, using header("Location: URL");.

------------------------------------------------------------------------

[2002-08-22 06:33:37] pratesi@telug.it

The following patch seems to workaround the problem for me,
on Debian Woody PPC:

--- ext/session/mod_files.c.orig        Tue Apr 23 20:10:49 2002
+++ ext/session/mod_files.c     Thu Aug 22 11:41:05 2002
@@ -255,12 +255,16 @@
        data->st_size = *vallen = sbuf.st_size;
        *val = emalloc(sbuf.st_size);

+/*
 #ifdef HAVE_PREAD
        n = pread(data->fd, *val, sbuf.st_size, 0);
 #else
+*/
        lseek(data->fd, 0, SEEK_SET);
        n = read(data->fd, *val, sbuf.st_size);
+/*
 #endif
+*/
        if (n != sbuf.st_size) {
                efree(*val);
                return FAILURE;

I.e., use of the read instead of pread seems to fix
the problem.
I wonder if this is a PHP bug (maybe endianess?)
or a glibc bug.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/15983

-- 
Edit this bug report at http://bugs.php.net/?id=15983&edit=1



Thread (46 messages)

« previous php.bugs (#18179) next »