I've been having trouble with a script that works fine in 4.1 and
4.2.3, but doesn't work in 4.3.0RC2.  It seems that if your script
generates a php notice (which is logged, not displayed to the screen)
something gets output anyway; this prevents setting cookies.  Here's
the simplest example I could come up with:

         if (!$undefinedVariable) {
                 if (setcookie ("code","123456")) {
                         print "Cookie set";
                 } else {
                         print "Could not set cookie";

Since $undefinedVariable is undefined, we get the following in the
server log:

PHP Notice:  Undefined variable:  undefinedVariable in
/home/www/dev/pLogin.php on line 2

which is fine; unfortunately, it's followed by:

PHP Warning:  Cannot modify header information - headers already sent
in /home/www/dev/pLogin.php on line 3

This shouldn't happen because display_errors is set to Off (which to me
means that nothing should be output to the user when there is a notice.

Can someone who's running 4.3.0RC3 try this script? (You probably have
to make sure error_reporting  is set to  E_ALL).  If this has been
fixed in RC3, it should say "Cookie set".  If it says "Could not set
cookie", it seems to me like this bug should be reported.

By the way, is there any easy way to see what's changed in pre-release
versions of PHP, short of digging through the CVS logs?


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to