CodeIgniter Forums
Incomprehensible problem about sessions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Incomprehensible problem about sessions (/showthread.php?tid=76277)



Incomprehensible problem about sessions - nicolas33770 - 04-29-2020

Good morning all,

I have been working for several weeks on a webapp project and I use sessions. I use Codigniter 3, and Jquery in order to display error messages. My notification system has been working for more than 4 or 5 weeks. I specify that I migrated to a new more powerful Proxmox server with SSD hard disks on which I migrated my LXC. I have been looking for more than 24 hours and I do not understand the problem.

I explain to you. I use a very simple session backup system for notification messages that I load when the pages are reloaded. I think I have found a solution to work around the problem but I would like to understand why it worked for several weeks and that now it no longer works ?


If I use one of the lines with the TAG (DOES NOT WORK ANYMORE), my "ajax_footer_load" data in sessions no longer appears while it was working before. I found a solution using "mark_as_temp" which is apparently working. But that worries me not to understand.

Do you have an idea ?


Code:
<script>
    $(document).ready(function() {
        <?php

        echo $this->session->ajax_footer_load;

        //$this->session->set_userdata('ajax_footer_load', ''); => DOES NOT WORK ANYMORE
        //$this->session->unset_userdata('ajax_footer_load'); => DOES NOT WORK ANYMORE
        //$this->session->mark_as_flash('ajax_footer_load'); => DOES NOT WORK ANYMORE
        //unset($_SESSION['ajax_footer_load']); => DOES NOT WORK ANYMORE

        $this->session->mark_as_temp('ajax_footer_load', 1); // => it seems to work

        ?>
    });
</script>



RE: Incomprehensible problem about sessions - includebeer - 05-01-2020

If you install your app on a new server and it stop working, there’s a very good chance the problem is the new server and not the app. And what does it mean “Does not work anymore”? Is there any error message? What should it do and what does it actually do?


RE: Incomprehensible problem about sessions - nicolas33770 - 05-02-2020

Thank you for your answer, given that my environments are in linux containers my software configuration has not been modified.

Is there any error message?
>> No error message, no log error.

What should it do:
>> echo data work

what does it actually do:
>> echo data don't show anything. is empty

The server I took is 10x faster than the previous one, even if it does not seem possible to me, is it possible that the variable is erased before being displayed? I also tried to go through a buffer variable, but I have the same result, ex:
tmpvar = $ this-> session-> ajax_footer_load;
echo tmpvar;

mark_as_temp works and displays my data, but it's still quite strange.