From:             [EMAIL PROTECTED]
Operating system: RedHat 7.2
PHP version:      4CVS-2003-02-05 (stable)
PHP Bug Type:     Output Control
Bug description:  logging warnings causes header() to fail

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 bug report at http://bugs.php.net/?id=22079&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22079&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22079&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22079&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22079&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22079&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22079&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22079&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22079&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22079&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22079&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22079&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22079&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22079&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22079&r=gnused

Reply via email to