Carl Michael Skog wrote:
> Some strange results with spurious newlines inserted in the response when
> requesting a php file has led me to investigating what happens when a
> completely empty php-file is requested.
>
> I would have thought that the response from a empty php file would also be
> empty, but, to my surprise, they consist of 3 newlines !!!
>
> The strange thing is that I observed this behaviour on two completely
> unrelated servers.
>
> Is this what can be expected or is it a result of misconfiguration ?

I just tried this with an empty PHP file, and got exactly what I expected.

A valid response with no content at all.

Please specify your software versions, and provide URLs and, as silly as
this sounds, an "ls -als empty.php" so we can see your empty PHP file.

Also check php.ini for auto_prepend_file and auto_append_file settings,
which might be tacking on blanks.

And, if you are using this as an "empty" file:
--------------- not quite empty file -----------------
<?php
?>
------------------------------------------------------
then PHP is quite right to send out the newline at the end.


----------------- really empty file -----------------
<?php
?>-----------------------------------------------------

Note that some editors, under some configurations, will *ADD* a newline to
a file on the last line for historical reasons.

Re-configure your editor *now* if yours does that, our include files and
calls to http://php.net/header will drive you crazy, or you'll end up
mis-using output buffering to "solve" your non-problem.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to