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

Andy Skelton skeltoac at gmail.com
Tue Apr 13 19:48:05 UTC 2010


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


More information about the wp-testers mailing list