Welcome Guest, Not a member yet? Register   Sign In
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, 05: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

(This post was last modified: 11-25-2016, 08:39 AM by prezire.)

(11-25-2016, 08: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!




Theme © iAndrew 2016 - Forum software by © MyBB