Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Session flash variable is not 'deleted'
  • Hi,

    I am using Session::set_flash for my 'Status' class, which shows validation messages if there are any. Now I found this: If I set and get the flash session variable on the same page, then the it will be available on the next page as well. For example: user tries to login, mistypes the password, (submit), validation fails, and the page continues loading, and shows the login form again. (Actually I should say request instead of page). The set and the get are in the same request.

    I also have to say, that my status class can contain more then one message, and they are stored in an array. So every time I set the flash variable, I actually get it, push the new element in the array and set it again. Maybe it is not the best way, I am thinking of rewriting it, but now I would like to solve this problem.

    Thanks
  • I don't understand what the problem is. Your flash message keeps on displaying?
  • Hi

    I got the same problem with following error when use Session::set_flash('error', $val->error()); in fuelphp1.4
    'Fatal error: Exception thrown without a stack frame in Unknown on line 0'

    It's just a validation error.


    Is this bug?



  • This can be anything.

    You get this error when you have an exception in the Exception handler. PHP bug that's been there a long time.
  • Actually I do not get an Exception. The flash message keeps displaying for one more request. But it is only a problem, when I want to use its value on the same page I set the value.
  • Session data is processed in the shutdown event, and the end of the request, and after output has been send to the client.

    When you set a flash variable, it is in a 'new' state. It is marked as old when the  session loads, and removed while processing the data when the state is 'old'.

    This means flash variables never expire within the same request, whether or not you have used them.
  • What's the php exception handler bug? am i using bad php version?

    My environment:
    CentOS release 6.3 kernel 2.6.32-220.13.1.el6.x86_64
    yum package: php-5.3.3-14.el6_3.x86_64
                          httpd-2.2.15-15.el6.centos.1.x86_64

    fuelphp1.3 is no probrem, get_flash update the state from 'new' to 'old',
    but fuelphp1.4 check the state 'expire' and doesn't flash in get_flash.


  • Yes, that was a bug in 1.3 and corrected (but appearently you want the old behavior).

    The bug is present in every PHP version, if you get an exception in the exception handler then PHP can not handle it, and gives a "error without a stack-frame in line 0" error..
  • HarroHarro
    Accepted Answer
    Added a third argument to get_flash() to allow you to expire a flash variable immediately.

    You need 1.5/develop to use this (or back-port the session class and all session drivers to your 1.4 installation).
  • Cool, thanks.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion