From: [EMAIL PROTECTED] Operating system: linux PHP version: 4.3.0RC3 PHP Bug Type: Output Control Bug description: notice leaks output when display_errors is off
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 bug report at http://bugs.php.net/?id=21046&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=21046&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=21046&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=21046&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=21046&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=21046&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=21046&r=support Expected behavior: http://bugs.php.net/fix.php?id=21046&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=21046&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=21046&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=21046&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21046&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=21046&r=dst IIS Stability: http://bugs.php.net/fix.php?id=21046&r=isapi