• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
session bug?

#1
I used session in many places.
when I set(update) part of session. the previous session data was destroied. only the updated data are available.

please test it!!
step one, use the follow data.

PHP Code:
$data = array(
 
       'userid'  => '1',
 
       'username'  => 'johndoe',
 
       'email'     => [email protected]'
);

$session->set$data); 

step two, run the follow code to update part of data.
PHP Code:
$newdata = array(
 
       'username'  => 'david name',
);

$session->set($newdata); 

now the session data is array('username'=>'david name')
the session of email and userid are not available.

is it a bug?
Q&A for Codeigniter
StartBBS--open-source, light weight forum software.
Best VPS:Digital Ocean

#2
(11-25-2016, 06:49 AM)startbbs Wrote: I used session in many places.
when I set(update) part of session. the previous session data was destroied. only the updated data are available.

please test it!!
step one, use the follow data.

PHP Code:
$data = array(
 
       'userid'  => '1',
 
       'username'  => 'johndoe',
 
       'email'     => [email protected]'
);

$session->set$data); 

step two, run the follow code to update part of data.
PHP Code:
$newdata = array(
 
       'username'  => 'david name',
);

$session->set($newdata); 

now the session data is array('username'=>'david name')
the session of email and userid are not available.

is it a bug?

Shouldn't you be passing 2 params with the key and its value instead of array like set('username', 'david');
Long live CodeIgniter!

#3
please check:
https://bcit-ci.github.io/CodeIgniter4/l...ssion-data

$session->set($array);is supported, 
Q&A for Codeigniter
StartBBS--open-source, light weight forum software.
Best VPS:Digital Ocean

#4
(11-25-2016, 09:10 AM)startbbs Wrote: please check:
https://bcit-ci.github.io/CodeIgniter4/l...ssion-data

$session->set($array);is supported, 

Yes it is. But using an array as a single param, erases the previous values. Use the 2 param style when setting a single value.
Long live CodeIgniter!

#5
Isn't this thread the same as this one: http://forum.codeigniter.com/thread-66651.html ?... which was also started by you...

#6
Duplicate thread!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.