Closed GoogleCodeExporter closed 9 years ago
So you are saying that the very end of the program, line 3082 in v1.8.6, we
should just not have the final ?> there? Why exactly does this cause white page
errors sometimes?
Original comment by daneirac...@gmail.com
on 31 May 2011 at 7:58
The ?> is only used when you want to switch context from PHP and into HTML.
Since you're not needing to do that, that's a CPU tick you don't need to spend.
As well, if this project were to ever expand, the ending ?> can sometimes cause
white page errors. I've seen it. The problem occurs often in projects where a
developer is including several files, and switching context a lot between PHP
and HTML, and then has one file with ?> and some spaces after it. You'll get
very hard to track white page errors. Back in 2007 I started noticing that MVC
frameworks don't have the ending ?> in their class files, and a senior PHP
developer explained to me that the ?> is only necessary when switching context
into HTML.
So, yeah, it's a minor thing, and in fact it's a moot thing because you're
already echoing the ending "</html>" tag. However, as a matter of principle,
it's not necessary, and therefore can be eliminated without harm.
Original comment by volom...@gmail.com
on 31 May 2011 at 8:04
I disagree. Putting PHP code inside <? and ?> tags is a good practice, no
matter whether this code is inside HTML or it is just pure PHP script.
Original comment by owl.brai...@gmail.com
on 1 Jun 2011 at 2:40
I think it's fine to have the ending tag. I did some research, and it only
really matters when the page is used to deliver sensitive binary or xml content
that can't have trailing whitespace. In our case of it being outputted HTML,
trailing whitespace doesn't matter, and we can just leave the ending tag.
Original comment by daneirac...@gmail.com
on 8 Jun 2011 at 3:15
Original issue reported on code.google.com by
volom...@gmail.com
on 30 May 2011 at 7:05