• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
session('something') fails intemittently

#1
Hi,

Part of my project adds an array to the session, which I use on nearly every view in my project.

in my view i access the array
PHP Code:
<?php foreach(session('items') as $arrayKey => $arrayValue) : ?>

                my item: <?= esc($arrayKey?>
                item value: <?= esc($arrayValue?>
    
             <?php endforeach ?>
Literally, and all of a sudden, every reference to session('item') stops working, in every views, generating (exception s where relevant)

However, if i run print_ in the asscociated controller:
PHP Code:
print_r($this->session-get('item')); 
The session and all of it's content arrays are intact.

As this piece of code is critical to my project it was created some time ago and is never (NEVER) touched.

Is their any reason why session('') would just stop?

Now here's the thing, I thought I maybe somehow be overloaeding the session (adding content / removing content).
So I destroyed the session. - This didnt fix the issue
I closed/restarted the browser - This didnt fix the issue
I restarted the server (hard boot) - This didnt fix the issue

But after all of this, about 2 hours after I first experienced the exceptions, everything all of a sudden works again, and I promise that apart from adding a few print_r here and there, and destroying and restarting sessions I have not changed a thing to my code, CI config or ther server.

Any ideas?????
Reply

#2
Did you view the server error log files to see if there where any errors?

This could be anything, running out of memory or to large of a cookie.

I would view the server error logs to see if any errors where reported.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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