CodeIgniter Forums
badly closed PHP config files - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: badly closed PHP config files (/thread-18531.html)



badly closed PHP config files - El Forum - 05-09-2009

[eluser]Unknown[/eluser]
Hi,

I just noticed that most (if not all) PHP files under 'system/application/config' dir are not closed.
There is a missing '?>' at the end.

<?php
....
....
....

?> ===> *missing*


I noticed that on 1.6.3 and fixed it myself a year ago (I thought I mistakenly removed them).
However, I upgraded to 1.7.1 yesterday, and in the merge I noticed that its missing in the source.


badly closed PHP config files - El Forum - 05-09-2009

[eluser]Pascal Kriete[/eluser]
They aren't needed in files that are PHP only (no html or other output). Errors caused by whitespace were (and still are) a frequent support problem, so the closing tags were removed and replaced with an end-of-file code comment. It's noted in the style guide.


badly closed PHP config files - El Forum - 05-10-2009

[eluser]MeanStudios[/eluser]
To add on to what Pascal said and also some personal experience, closing tags can really be bothersome sometimes. If you have just one space after the tag it can cause some really bad problems and if you are a non-experienced programmer, it can take you awhile to figure out what's wrong. I for one don't use them anymore heh.


badly closed PHP config files - El Forum - 05-10-2009

[eluser]Dam1an[/eluser]
Despite these potential problems of closing php tags, I for some reason hate not having them (not enough to add tem to core files, just to my own)
I've never had any problem yet


badly closed PHP config files - El Forum - 05-11-2009

[eluser]n0xie[/eluser]
This is by design, read this: http://ellislab.com/codeigniter/user-guide/general/styleguide.html#php_closing_tag