[wp-trac] Re: [WordPress Trac] #7149: prevent inadvertent output
from included files
WordPress Trac
wp-trac at lists.automattic.com
Sat Jun 28 00:17:44 GMT 2008
#7149: prevent inadvertent output from included files
-------------------------+--------------------------------------------------
Reporter: mm6 | Owner: anonymous
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: General | Version:
Severity: normal | Resolution: invalid
Keywords: |
-------------------------+--------------------------------------------------
Comment (by jacobsantos):
Sorry, let me explain it better.
It is hackish because there is a better fix: remove the ending {{{?>}}}
from the ends of the files.
This is a known problem with a known solution. Sorry, but during your
journey as a programmer you will find stuff to be not as they seem and on
some of them, you are SOL.
You comment of having an closing {{{?>}}}, because there is an opening PHP
tag is inaccurate. PHP is not a markup language, does not require the
closing PHP tag. To compare a programming language with markup language
isn't logical. Just because you can put markup in with the code, doesn't
mean anything. If you check the Opcodes or the assembly, you will see that
it doesn't matter to PHP. Also, during the compile stage of PHP, all of
the included files are combined anyway, therefore it stands to reason that
you don't actually need the closing tag because PHP doesn't need it.
However, the coding standards of WordPress state that all files might have
the closing PHP tag and that leaves us where we are today.
The known solutions are:
1. Remove the whitespace causing the problem.
1. Remove the closing PHP characters '{{{?>}}}'.
Those are the only two, anything else should not be considered. I'll
further explain. The time it would take you to build the solution, test
the solution and then support the solution doesn't seem worth it. Want
happens when there is an included file outside of the output caching? You
might face the same problem.
If prevention is what you are trying to do then write a script that
removes the closing PHP tag from all of the library files for your system.
You can even build a plugin which does this for other people. It isn't
difficult.
--
Ticket URL: <http://trac.wordpress.org/ticket/7149#comment:10>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list