[wp-testers] Missing "?>" tag in "wp-config.sample.php"

Kirk M kmb42vt at gmail.com
Tue Apr 13 20:05:13 UTC 2010


An excellent explanation, Andy...thanks! Obviously I've been one of 
those "PHP must be balanced" type folks. Didn't know about the blank 
lines under the closing tag either. I need to mark this particular 
message in my email for reference for when my old(er) brain fails to 
recall this correctly. Happens more and more often these days. :P
I'll also add the comment in my "wp-config.php" file like you suggested.

On 04/13/2010 03:48 PM, Andy Skelton wrote:
> On Tue, Apr 13, 2010 at 9:13 AM, Nathan Rice<ncrice at gmail.com>  wrote:
>> the closing ?>  tag at the end of a PHP file isn't necessary.
>
> Yes, it is best to leave it out UNLESS it causes bug reports.
>
> However, people new to PHP often assume that PHP tags must be
> balanced. Instead of verifying their assumption they call attention to
> the "issue". This is understandable (we've all been there) so I have
> another solution:
>
> You can add a comment to the end of the file:
>
> /* PHP does not require a closing tag (?>) at the end of a
> script. Actually it's safer this way, as you are less likely to
> break your site. You see, blank lines after the closing tag
> cause PHP to send the headers. It has to send them before
> the first byte of the response can be sent. Later, WordPress
> tries to send headers and PHP throws a warning. So the
> omitted "?>" is not a bug; don't email anybody about it.
> However, it is necessary to close this comment to avoid an
> even worse error so we'll do that now. */
>
> Andy
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers


More information about the wp-testers mailing list