CodeIgniter Forums
A PHP Error Severity: Notice Message: session_write_close(): Skipping numeric key 0 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: A PHP Error Severity: Notice Message: session_write_close(): Skipping numeric key 0 (/showthread.php?tid=67295)



A PHP Error Severity: Notice Message: session_write_close(): Skipping numeric key 0 - raminderrandhawa - 02-06-2017

I upgraded from codeigniter 2.21 to 3.1.3 and getting this error message


RE: A PHP Error Severity: Notice Message: session_write_close(): Skipping numeric key 0 - InsiteFX - 02-07-2017

The keys in the $ _SESSION associative array are subject to the same limitations as regular variable names in PHP,
ie they can not start with a number and must start with a letter or underscore.

For more details see the section on variables in the PHP manual.

Or you did not follow the upgrade right.


RE: A PHP Error Severity: Notice Message: session_write_close(): Skipping numeric key 0 - raminderrandhawa - 02-10-2017

(02-07-2017, 04:20 AM)InsiteFX Wrote: The keys in the $ _SESSION associative array are subject to the same limitations as regular variable names in PHP,
ie they can not start with a number and must start with a letter or underscore.

For more details see the section on variables in the PHP manual.

Or you did not follow the upgrade right.

I have followed the upgrade instructions. This error goes away if I write Session_write_close(); in the beginning of that controller class.
I just wanted to confirm is this a right way to do.


RE: A PHP Error Severity: Notice Message: session_write_close(): Skipping numeric key 0 - InsiteFX - 02-10-2017

You use it when you are finished with the session data that you are using.


RE: A PHP Error Severity: Notice Message: session_write_close(): Skipping numeric key 0 - raminderrandhawa - 02-10-2017

(02-10-2017, 07:33 AM)InsiteFX Wrote: You use it when you are finished with the session data that you are using.

I used it in the wrong way. I m not supposed to write session_write_close(); 
Earlier in the code we were using associative array by writing the following code 
$data_test_info=array(
'sphere',
'machine',
'temp',
'humidity',
'pressure'
);
But now I have changed it to 
$data_test_info=array(
            "key1" => "sphere",
            "key2" => "machine",
            "key3" => "temp",
            "key4" => "humidity",
            "key5" => "pressure"
        );
Now, it runs correctly. But I have doubt that is this change related with codeigniter update from 2.2.1 to 3.1.3. Because earlier the application was not having this error.


RE: A PHP Error Severity: Notice Message: session_write_close(): Skipping numeric key 0 - InsiteFX - 02-10-2017

In CI 3+ the session library has been completely re-written.