Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Flash bug when redirect_to (again)

#22

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.

Reported by Fabrice Luraine · August 7th, 2009 @ 01:34 PM

State: resolved
Assigned to: Fabrice Luraine Fabrice Luraine

Activity

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.