From:             [EMAIL PROTECTED]
Operating system: Win98SE
PHP version:      4.2.3
PHP Bug Type:     Session related
Bug description:  Table variable not correctly working as session cookie

First here's the whole script:

<?php

session_start();

if(!session_is_registered('ind'))
{
        $ind = 0;
        session_register('ind');
        $table[$ind] = 1;
        session_register("table");
}
else
{
        $ind = $_SESSION['ind'];


        //Lisätään alkio tauluun
        $table[$ind] = 1;
        session_register("table");
}

//increases the index
$ind++;

$_SESSION['ind'] = $ind;

$i= 0 ;

//prints all the data in $table
while ($i < $ind)
{
        print("$table[$i]<br>");
        $i++;
}

?>

I have tested this script both Linux(script works perfectly) and
Win98SE(doesn't work). Both have Apache and PHP 4.2.3.

So I'm using session cookie $table where to store number 1 in each index.
Index increases every time i press refresh. Script should print (after
three refresh):
1
1
1
1

But with my Windows scripts prints (after three refresh):

Notice: Undefined offset: 0 in c:\www\sessio_taulu_testi.php on line 32


Notice: Undefined offset: 1 in c:\www\sessio_taulu_testi.php on line 32


Notice: Undefined offset: 2 in c:\www\sessio_taulu_testi.php on line 32

1


When entering the script for the first time scripts prints correctly:
1

I have deleted the session file after each time I've executed the script,
so that shouldn't be the problem.


I would like to know what's the problem in here :)
-- 
Edit bug report at http://bugs.php.net/?id=21083&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21083&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21083&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21083&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21083&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21083&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21083&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21083&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21083&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21083&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21083&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21083&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21083&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21083&r=isapi

Reply via email to