ID: 29162 Updated by: [EMAIL PROTECTED] Reported By: php-bugs at carldunham dot com Status: Open -Bug Type: Output Control +Bug Type: Documentation problem Operating System: Linux (Gentoo 1.4) PHP Version: 4.3.7 New Comment:
This is expected behavior, it should be documented. Previous Comments: ------------------------------------------------------------------------ [2004-07-14 22:00:29] php-bugs at carldunham dot com Description: ------------ It seems that a script executing in response to a HEAD request will terminate when non-header output is generated. This can lead to different behavior in HEAD vs GET, which may not be desirable. Other bug reports (http://bugs.php.net/bug.php?id=15693) have indicated that the entire script executes, which does not seem to be the case. I was unable to find documentation of what is the intended behavior, although I would vote for having the script complete no matter the method, as working around cases where that is not desirable is easier: if ($_SERVER['REQUEST_METHOD'] == 'HEAD') exit(); at the top of a script, vs. if ($_SERVER['REQUEST_METHOD'] != 'HEAD') { // do outputty things } // do non-outputty things sprinkled throughout the code. Reproduce code: --------------- <?php $fp = fopen('/tmp/test-head.out', 'a'); fwrite($fp, "Method = " . $_SERVER['REQUEST_METHOD'] . "\n"); echo "hello"; fwrite($fp, "POST: " . print_r($_POST, true) . "\n"); fwrite($fp, "GET: " . print_r($_GET, true) . "\n\n"); fclose($fp); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29162&edit=1