[wp-hackers] Discussion about Optional Closing PHP tags in the WordPress Library

Viper007Bond viper at viper007bond.com
Wed Jun 18 01:51:01 GMT 2008


I don't really see how this could be of any matter to the end user. If
there's a problem, they should upload the file again. Problem solved.

The one exception is wp-config.php where it's best to leave the end tag off
due to how easy it is for a novice and their editor to add a trailing
whitespace.

On Tue, Jun 17, 2008 at 5:23 PM, Jacob Santos <wordpress at santosj.name>
wrote:

> You know, it is a really good thing that the discussion is a closed matter.
> The Coding Standards aren't up for debate, however, there are some issues
> I've come across, which I would like some input on how it can be addressed
> in the least amount of elitism as possible. Luckily, everyone here is
> educated enough to understand the debate, so it should be more about
> solutions than debating about something.
>
> The first problem I've encountered is a Trac ticket, which questioned the
> lack of a closing PHP tag at the end of a file. It was handled pretty well.
> The coding standard states that all library files and PHP file have a
> closing PHP tag. Sort of like XHTML, you have a opening tag, then you have
> closing tag, even if it is optional (like HTML). So the tag was added, end
> of story.
>
> Right, so the problem is this. If you leave the closing PHP tag out, then
> you have people informing you that you have a bug since PHP "requires" a
> closing PHP tag.
>
> The second problem is in #7149, where you have the opposite problem. A new
> line is accidentally added to the end of a WordPress library file causing
> errors to occur in the execution. The solution is to remove the offending
> new lines and carry on with your merry day. However, so a "solution" came
> in, which really isn't a very good one. To avoid worrying about new lines
> creeping into files and causing issues, you could remove all of the closing
> PHP tags from those files (see problem #1).
>
> I'm not sure if there is a proper channel for relaying PHP troubleshooting
> to users or if one should exist. The problem doesn't affect enough people to
> actually do anything code wise. If there isn't already, would a Common
> Troubleshooting page on the WordPress Codex for PHP errors that come up be
> helpful? You could just point them to that page?
>
> Really, from the commonly quoted message on the subject, the conclusion
> translates to that it is better to have the closing PHP tag, so that those
> who don't know better don't get tripped up on the small stuff. Whether or
> not WordPress should have the closing PHP tag is not at issue here. How is
> this problem, when it occurs troubleshooted for users?
>
> I'm not sure my response, "Learn PHP!" would be all that helpful and could
> come across as being an ass.
>
> Thanks.
>
> Jacob Santos
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Viper007Bond | http://www.viper007bond.com/ | http://www.finalgear.com/


More information about the wp-hackers mailing list