Skip to content

Commit

Permalink
Fix flash bug when redirect_to [#22 state:resolved]
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrice Luraine committed Aug 7, 2009
1 parent d87f108 commit 68b9688
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/limonade.php
Expand Up @@ -410,15 +410,19 @@ function route_missing($request_method, $request_uri)
function stop_and_exit($exit = true)
{
call_if_exists('before_exit');
$flash_sweep = true;
$headers = headers_list();
foreach($headers as $header)
{
if(stripos($header, 'Content-Type: text/html') === 0)
// 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();
$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;
Expand Down

0 comments on commit 68b9688

Please sign in to comment.