Lowering value?> Only in PHP files

Possible duplicate:
PHP end tag

I recently read that? > should be omitted from files containing ONLY PHP

In fact, even the Zend Framework code standard strongly recommends against using? > in files containing only PHP, because:

For files containing only PHP code, a closing tag ("?>") Is never allowed. It is not required by PHP, and its exclusion prevents accidental injection of the rear run in response.

Is trailing blank injection really bad? And really, is this a heinous crime not to be let down? > From files containing only PHP? It just seems unnatural to me to do this.

+4
source share
3 answers

If you add a space to include, and then try to use header() (or something else that depends on the run before the content is displayed), then you will enter a hellish debugger. This is a quick and easy way to avoid this.

+4
source

If an accidental injection occurs, you cannot send a headline or start a session, but errors will show you this. If this happens in every file that you have, you have some problems.

0
source

As far as I know, the code police do not work, chopping off people's hands for doing something like that. Am I writing good code and leaving ?> C.

-one
source

Source: https://habr.com/ru/post/1398620/


All Articles