I'm a reasonably competent programmer by most standards and I was burned by PHP once.
If you include a file with their include() function and have whitespace after the closing ?> tag in the file--PHP will throw an error.
Except it gets better: whether this happens or not depends on a setting in php.ini (output buffering I think).
This happens if you're trying to send header information from the parent file but include a file that outputs whitespace on accident. The output buffering delays sending the output (because it's buffered, duh :)) so the header info can be sent, hence no error.
This is one of those things I didn't know and wish I did.
That's one of the most irritating problems with PHP due to the impossibility to find the bug (well, it's a whitespace, it's not as if one could see it). On my server, including a file with a whitespace after the ?> actually made the server send the PHP source code as text, including the mysql passwords that were included in the file.
Ouch, I generally try to put password files in directories not even in www_root, that way if the web server config gets messed up this stuff isn't even possible.
To a non-PHP programmer it's pretty non-intuitive to omit a closing tag. Most programmers are trained to balance things like tags, parentheses, and curly braces.
The same occurs in Drupal template files (which are powered by PHPtemplate, by default anyway). Including the closing tag with whitespace after causes a white screen of death which can be infuriating to debug - unless you know this.
If you include a file with their include() function and have whitespace after the closing ?> tag in the file--PHP will throw an error.
Except it gets better: whether this happens or not depends on a setting in php.ini (output buffering I think).
This happens if you're trying to send header information from the parent file but include a file that outputs whitespace on accident. The output buffering delays sending the output (because it's buffered, duh :)) so the header info can be sent, hence no error.
This is one of those things I didn't know and wish I did.
http://stackoverflow.com/questions/1793482/php-error-cannot-...
The work around: omit the closing ?> tag from included files.