php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15493 PHP sends no location header when output_buffering = On
Submitted: 2002-02-10 18:16 UTC Modified: 2002-04-30 00:00 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: john dot zoetebier at transparent dot co dot nz Assigned:
Status: No Feedback Package: Output Control
PHP Version: 4.0.6 OS: Linux 2.4.8
Private report: No CVE-ID: None
 [2002-02-10 18:16 UTC] john dot zoetebier at transparent dot co dot nz
//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 .....
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-13 02:03 UTC] yohgaki@php.net
4.2.0's output related code differs from 4.1.1. Could you try snapshot?

http://snaps.php.net/

Please report the result. Thanks.
 [2002-02-13 08:34 UTC] yohgaki@php.net
4.2.0's output related code differs from 4.1.1. Could you try snapshot?

http://snaps.php.net/

Please report the result. Thanks.
 [2002-02-13 21:25 UTC] john dot zoetebier at transparent dot co dot nz
I tried to follow the instructions in INSTALL.
Configure option --with-apxs was not working as this package was not installed on my machine.
As package apxs was not delivered with Mandrake 8.1 AND PHP 4.0.6 was running fine without this package it did not look required to me (maybe I am wrong).
I decided to take over the options as indicated by phpinfo() in php4.0.6.
After "make install" all files in /usr/lib/php were updated.
Directory /usr/lib contained a new binary of php (3.1 Mb).
However a new version of php module libphp4.so was not generated.
phpinfo() shows that 4.0.6 is still running on my system.

 [2002-02-24 06:00 UTC] yohgaki@php.net
Try to intall from the beginning for both apache and php using source.

If you don't include modules, you should be able to install apache and php easily if you follow manual. If you have problem, ask to php-general or php-install list.

Report back if you still have problem if you have problem with CVS snapshot. Thanks.
http://snaps.php.net/

 [2002-04-30 00:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 22:01:29 2024 UTC