ID:               22079
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Feedback
+Status:           Open
 Bug Type:         Output Control
 Operating System: RedHat 7.2
 PHP Version:      4CVS-2003-02-05 (stable)
 New Comment:

>This isn't the source of 'problem.php'
But it is! the messages and source code are exactly that!
http://docs.ndg.ru/p1.php
this one works as intended (in all versions) - redirects to ok.php
<?php
#$res=$na['na'];
header('Location: ok.php');
echo 'hi';
?>
this one fails in cgi versions and produces those error messages in
error_log:
http://docs.ndg.ru/p2.php
<?php
$res=$na['na'];
header('Location: ok.php');
echo 'hi';
?>

also, see the http "conversation":

GET /p1.php HTTP/1.1
HOST: docs.ndg.ru

HTTP/1.1 302
Date: Wed, 05 Feb 2003 22:05:10 GMT
Server: Apache/1.3.27 (Unix) PHP/4.3.0
X-Powered-By: PHP/4.3.1-dev
Location: ok.php
Transfer-Encoding: chunked
Content-Type: text/html; charset=windows-1251

2
hi
0

GET /p2.php HTTP/1.1
HOST: docs.ndg.ru

HTTP/1.1 200 OK
Date: Wed, 05 Feb 2003 22:05:39 GMT
Server: Apache/1.3.27 (Unix) PHP/4.3.0
X-Powered-By: PHP/4.3.1-dev
Transfer-Encoding: chunked
Content-Type: text/html; charset=windows-1251

2
hi
0

==
my point is, regardless of whether outputting anything after
header('Location: xxx') is correct or not (in fact if i comment out the
last line, the behaviour is exactly the same), this effect is IMHO
undesired and illogical.


Previous Comments:
------------------------------------------------------------------------

[2003-02-05 15:40:20] [EMAIL PROTECTED]

This isn't the source of 'problem.php' as the 'header already sent'
points to line 3, which is the header command itself. It never points
to the header line itself.

Please include post script, so that the correct line is reported.

Also -> this is bound to fail, as line 4 outputs stuff. The header
function != redirect. You should call exit after after the header
command.

I'm leaving this open, since user reports it works in the module
version.

------------------------------------------------------------------------

[2003-02-05 12:30:00] [EMAIL PROTECTED]

What i am trying to do: send headers
What happens: headers don't get sent under the excuse that "output
already started" if any messages have been logged by error_reporting,
although no output has been sent to the browser. (logging goes to
error_log) If i disable reporting E_NOTICE or logging, problem
disappears.

this happens under php 4.3.0 and the fresh snapshot from Feb 5, when
used in cgi mode in the following ways:
Action php-script /php4/php
-or-
#!/usr/bin/php
it DOES NOT happen under mod_php 4.3.0

code that exhibits the problem:
(i expect to get redirected to ok.php but i see hi instead)
if i remove the errorneous line that causes warnings, it works as
intended.
<?php
$res=$na['na'];
header('Location: ok.php');
echo 'hi';
?>

error_log:
PHP Notice:  Undefined variable:  na in /www/mysite/htdocs/problem.php
on line 2
PHP Warning:  Cannot modify header information - headers already sent
in /www/mysite/htdocs/problem.php on line 3

configure options:
./configure \
        --with-config-file-path=/svr/php-cgi \
        --prefix=/svr/php-cgi \
        --enable-force-cgi-redirect \
        --disable-cli \
        --enable-bcmath \
        --enable-trans-sid \
        --with-zlib-dir=/build/zlib-1.1.4 \
        --with-gd=/build/gd-1.8.4 \
        --with-png-dir=/build/png-1.2.4 \
        --with-jpeg-dir=/build/jpeg-6b \
        --with-freetype \
        --with-mysql=/usr/local \
        --with-gettext \
        --with-imap \
        --with-imap-ssl \
        --with-kerberos \

php.ini, relevant options:
error_reporting E_ALL
output_buffering On
log_errors on
display_errors off


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22079&edit=1

Reply via email to