From:             rob_raux at redkeysolutions dot com
Operating system: Linux 2.4.18-14
PHP version:      4.3.4
PHP Bug Type:     Session related
Bug description:  specific array in session causes data not to store

Description:
------------
My apologies if this is a dup, I've searched and searched and found
nothing.



php.ini [relevant]:

session.save_handler = files

session.save_path = /tmp

session.use_cookies = 1

session.use_only_cookies = 1

session.name = PHPSESSID

session.auto_start = 0

session.cookie_lifetime = 0

session.cookie_path = /

session.cookie_domain =                                                   
                                                

session.serialize_handler = php



As commented in the code, the $_SESSION variable is not correctly set when
both $array[1] and $array['string'] are set. 

Reproduce code:
---------------
<?php

                                                                          
                         

session_start();

                                                                          
                         

//this is our goal, to get here.

if(isset($_SESSION['allSet'])){

  print_r($_SESSION);

  session_destroy();

}

//start the test.

else{

  /* this numeric key creates the problem.

   commented out "$basic_array[0] = 4;" and this code will work fine,

   otherwise we have an infinite redirect. */

  $basic_array[1] = 4;

                                                                          
                         

  $basic_array['user_id'] = 4;

  $basic_array['email'] = "[EMAIL PROTECTED]";

                                                                          
                         

  foreach(array_keys($basic_array) AS $key){

    $_SESSION[$key] = $basic_array[$key];

  }

                                                                          
                         

  $_SESSION['allSet'] = 1;

  header("Location: http://FULLPATHTOSERVER/LOGINTEST.php";);

}



Expected result:
----------------
The $_SESSION variable should contain all the relevant data.

Actual result:
--------------
$_SESSION contains no data, despite being set.

-- 
Edit bug report at http://bugs.php.net/?id=27394&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27394&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27394&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27394&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27394&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27394&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27394&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27394&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27394&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27394&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27394&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27394&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27394&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27394&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27394&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27394&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27394&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27394&r=float

Reply via email to