note 8644 added to setcookie

From: Date: Fri, 22 Sep 2000 02:34:51 +0000
Subject: note 8644 added to setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-5291@lists.php.net to get a copy of this message
This is a really stupid bug in php 4.??/Redhat 6.2/IE/Netscape etc... If you try to set a cookie is a function that is defined in an include file, you are very likely to get an error saying "headers already sent". This is a bug because you get this error even if you haven't printed anything yet. Ironically the problem is that it reads extra white space after the ?> at the end of the include file as stuff to print out!!! Therefore to fix the problem replace the closing ?> with: return;?> This ensures that no whitespace will be printed! http://www.php.net/manual/function.setcookie.php

« previous php.notes (#5291) next »