#21046 [Opn->Fbk]: notice leaks output when display_errors is off
| From: | iliaa@php.net | Date: | Mon, 16 Dec 2002 16:35:50 +0000 |
| Subject: | #21046 [Opn->Fbk]: notice leaks output when display_errors is off | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-27863@lists.php.net to get a copy of this message | ||
ID: 21046
Updated by: iliaa@php.net
Reported By: alexweb@satoridesign.com
-Status: Open
+Status: Feedback
Bug Type: Output Control
Operating System: linux
PHP Version: 4.3.0RC3
New Comment:
In the same directory as your script put a script with
<?php phpinfo(); ?>
Then in the output of that script check what the display_errors is set
to, it is possible that you are either using the wrong .ini file,
httpd.conf overwriting your settings for the virtual host or you have
.htaccess that changes display_errors to On.
So far, neither I nor other developers who have tried to replicate the
problem you've described were able to do so.
Previous Comments:
------------------------------------------------------------------------
[2002-12-16 10:05:59] alexweb@satoridesign.com
If a script generates a php notice (which is logged, not displayed to
the screen) something gets output anyway; this output can prevent
setting cookies.
<?
if (!$undefinedVariable) {
if (setcookie ("code","123456")) {
print "Cookie set";
} else {
print "Could not set cookie";
}
}
?>
We get the following in the server log:
PHP Notice: Undefined variable: undefinedVariable in
/home/www/dev/pLogin.php on line 2
PHP Warning: Cannot modify header information - headers already sent
in /home/www/dev/pLogin.php on line 3
However, if you add the line
$undefinedVariable = false;
so that the notice goes away, PHP will happily set the cookie.
display_errors = off, error_reporting = E_ALL, log_errors = On.
Note: This happens on 4.3.0RC2; unfortunately, I could not test on RC3.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21046&edit=1