#22 ✓resolved
Fabrice Luraine

Flash bug when redirect_to (again)

Reported by Fabrice Luraine | August 7th, 2009 @ 01:34 PM | in Release 0.4 - Fresh Mint And Ginger

Flash features does'nt applies when we use redirect_to because there is no HTTP Content-type header sended in this case.

For now, a simple solution would be to handle this case in the stop_and_exit() function like this:

/**
 * Stop and exit limonade application
 *
 * @access private 
 * @param boolean exit or not
 * @return void
 */
function stop_and_exit($exit = true)
{
  call_if_exists('before_exit');
  $flash_sweep = true;
  $headers = headers_list();
  foreach($headers as $header)
  {
    // If a Content-Type header exists, flash_sweep only if is text/html
    // Else if there's no Content-Type header, flash_sweep by default
    if(stripos($header, 'Content-Type:') === 0)
    {
      $flash_sweep = stripos($header, 'Content-Type: text/html') === 0;
      break;
    }
  }
  if($flash_sweep) flash_sweep();
  if(defined('SID')) session_write_close();
  ob_end_clean(); // when request_is_head()
  if($exit) exit;
}

... i'm still looking for a strongest way to manages flash messages.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Limonade is a PHP micro-framework.

People watching this ticket

Referenced by

Pages