Bug #15493: PHP sends no location header when output_buffering = On

From: Date: Sun, 10 Feb 2002 23:16:44 +0000
Subject: Bug #15493: PHP sends no location header when output_buffering = On
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86@lists.php.net to get a copy of this message
From: john.zoetebier@transparent.co.nz Operating system: Linux 2.4.8 PHP version: 4.0.6 PHP Bug Type: Output Control Bug description: PHP sends no location header when output_buffering = On //Bug in PHP 4.0.6 If output_buffer = On AND session_start() AND header("Location: ..) AND no HTML output then PHP sends no header You expect the browser to redirect to Location URL. What really happends depends on the browser: - Netscape: waits a while and nothing happens - IE: redirects to search engine - Konqueror: connection lost - Some browsers indicate empty document received Work around: - when output buffering is on, then add blank line before start of script - switch output buffering off Example PHP page excerpt: <?php session_start(); if (!isset($HTTP_COOKIE_VARS['CompanyID'])) { $Info = urlencode("Please log in."); header("Location: Login.php?Info=$Info"); exit; } // More lines ..... ?> -- Edit bug report at http://bugs.php.net/?id=15493&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15493&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15493&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15493&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15493&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15493&r=support Expected behavior: http://bugs.php.net/fix.php?id=15493&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15493&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15493&r=submittedtwice

« previous php.bugs (#86) next »