codeigniter


CodeIgniter sess_destroy does not delete user_data session?


I am creating test case for my CodeIgniter app. However I just found something that I thought should not be happen :
in login.php controller :
public function logout()
{
$this->session->sess_destroy();
redirect('/');
}
So I just created a test to just make sure that session is really destroyed :
public function test_logout()
{
$this->CI = set_controller('login');
// make sure that all session is destroyed
$this->CI->session->set_userdata('test_session', 'some_value');
$this->CI->logout();
// userdata 'test_session' should be removed!
$this->assertTrue(($this->CI->session->userdata('test_session')==null || $this->CI->session->userdata('test_session')==''));
}
However I find that upon running the test case, my test case fails! Upon debug on the last line of test case, I found that the userdata is still exist with value = 'some_value'. I thought that sess_destroy should also delete all the set user data, as per what they described in their website documentation:
This function should be the last one called, and even flash variables will no longer be available. If you only want some items destroyed and not all, use unset_userdata().
I am using Kenji's CIUnit for unit testing.
Is this the correct behaviour or is there something that I missed?
Just found that CIUnit routes the Session to CIU_Session instead of original CodeIgniter's CI_Session. It miss a line that CI_Session does :
$this->userdata = array();
So turns out this is CIUnit's issue instead of CodeIgniter's. Create an issue in their bitbucket page.

Related Links

CodeIgniter translate PHP date
Not Equal to Comparison in Codeigniter Active recods
Parallel Programming in Codeigniter
CodeIgniter-Checking session variable is already set or not when clicking each link or reloading page
Where fieldname is null using active record
how to send array of values to a query dynamically in codeigniter
Codeignitor active record nested select issue
Codeigniter and i18n for ajax url
How to debug CI-Merchant Paypal Pro integration?
Different user levels
codeigniter session is not storing all data
Dynamic Get Clumn value
Pagination CodeIgniter: Page, wrong link
codigniter limit function not working with $this->db->query($sql) [closed]
add_column bug for Postgres with Codeigniter?
HybridAuth keeps giving “User profile request failed. Most likely the user is not connected to the provider and he should to authenticate again.”

Categories

HOME
selenium
web-services
bootstrap-4
xaml
elf
openshift-origin
python-3.5
apacheds
gluu
wikipedia-api
netbeans-8
phpmailer
range
librsvg
eloqua
w3.css
scope
nanotime
axios
ellipse
helpers
gas
lexikjwtauthbundle
pydev
haml
rgdal
google-distancematrix-api
missingmethodexception
mouseevent
intersystems
unsigned-integer
point-cloud-library
ucwa
mediacodec
masstransit
reformatting
json-c
directx-12
stomp
pyparsing
machine-language
dashboard-designer
roo
spring-data-cassandra
ecmascript-4
angular-xeditable
azure-management-api
word-embedding
mamp-pro
freerdp
nscalendar
clientscript
azure-cdn
node.js-tape
canopen
g-wan
ietf-netconf
catalina
tastypie
curly-braces
manifoldcf
masspay
vs-2015-preview
tachyon
mailcore2
setwindowshookex
xendesktop
hyperterm
scrutinizer
flotr2
android-popupwindow
lidar
oracle-bi
interpreted-language
android-listfragment
simperium
sql-server-ce-3.5
conditional-statements
android-tablelayout
json-web-token
gnat
django-postgresql
dynamic-typing
xml.modify
blazeds
gdb-python
adlds
argumentexception
ariatemplates
ad-hoc-distribution
oledbcommand
server.mappath
nsinvocation
katta
process.start
unitils
indextank
cassandra-0.7
virtual-server
plumtree

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App