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

Jacob Santos wordpress at santosj.name
Wed Jun 18 02:09:13 GMT 2008

Depends, it is more likely than not, that the person that filed in the 
ticket in question did open the file in their editor to figure out where 
a function is. Some editors have issues (Dreamweaver) with the different 
styles and doubling the new lines.

To answer your question, if it was more of a problem, then there would 
be a lot more people facing the problem, so I doubt that the exception 
will be made. My opinion of course.

Actually, it is probably that no one edits their wp-config.php file 
after WordPress makes it. I doubt many end users are going to do it, 
even if it should be done for the SECRET_KEY constant.

I suppose there should be some way to tell people who face this issue 
that they shouldn't be editing PHP without making them feel like they 
are idiots and shouldn't be editing PHP.

Sigh, actually, I do know of a couple more instances where the dreaded 
double new lines caused issues and tickets on the Trac. Just close as 
invalid and inform the submitter that the problem is not the fault of 
WordPress. Just one solution I suppose.

Jacob Santos

Viper007Bond wrote:
> 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

More information about the wp-hackers mailing list