php - Session variable in Kohana 3 keeps being reset after having been deleted -


I have a notice class that is used once to provide message notifications The notification is stored in Koha Session (cookie) and my recipient looks like this (for ACO debugging):

  Private static function _get ($ key) {$ session = session: : Examples (); $ Value = $ session- & gt; Get ($ key); Revert $ key ':'. $ Session- & gt; Get ($ key) '& lt; Br / & gt; '; $ Session- & gt; ($ Key); The echo is 'destroyed'. $ Key ', value now:'. $ Session- & gt; Get ($ key). '& Lt; Br / & gt; & Lt; Br /> ';; $ Return; }   

Now, on the one page I use this category is the login page. When a user enters wrong login information, I also expect: There is an error in saying "username / password wrong". This message should be deleted because I have called the getter and it removes it from the recipient session.

However, this is not the case. The message is also shown on the next page and if I go to any other page which shows the notification, then the error is also shown there, unless a different error is displayed (say that I enter information on any other form I'm here).

This is the echo on the page that is displayed:

Error: Username / password combination is incorrect.
Deleted error, value now:

indicating that the value is being deleted, but whenever I refresh the page He is also showing the same thing.

If this helps, then the process of setting an error message is from a controller. I notice :: error ('message'); which call this method:

  public static function error ($ value = NULL) {return Notices :: _ notice ('error', $ value); }   

who calls:

  private static functions _notice ($ key, $ value) {// if the value is not zero, then notice Store (! Is_null ($ value)) {Notice: _ set ($ key, $ value); Return TRUE; } Else {// if the value is not zero. Delete the key and format the HTML if (! Is_null ($ value = notice :: _ get ($ key)) {return "$ value"; } // If the key does not exist then return empty string (return ';}}}   

and setter looks like this:

  private Fixed work _set ($ key, $ value) {session :: example () - & gt; set ($ key, $ value); return TRUE;}    

< Div class = "post-text" itemprop = "text">

If the session settings are playing on you, then check two things:

  1. It appears that when you Until you flush it, you do not have to hold the remains of the elements.
  2. You can use the same method Sessions are also not set, thus replacing it when you refresh the page or call the method. Variable

    You KohanaSession The current get_once method should also look at the class that destroys the variable after it takes it out of the $ _ session / <> code:

     < Code> / ** * Receive and delete a variable from the session array. * * $ Bar = $ session- & gt; get_once ('bar'); * * @ ultimate string variable name * @ ultimate mixed default To return the value * @ Return Mixed * / Public Function get_once ($ key, $ default = zero) {$ value = $ this- & gt; Get ($ key, $ default); Not set ($ this- & gt; _data [$ key]); $ Return; }    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

memcached - Django cache performance -