Bug #15693: HTTP HEAD request executes entire script

From: Date: Sat, 23 Feb 2002 23:52:28 +0000
Subject: Bug #15693: HTTP HEAD request executes entire script
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-877@lists.php.net to get a copy of this message
From: patrick@ginx.com Operating system: FreeBSD 4.5 PHP version: 4.1.1 PHP Bug Type: HTTP related Bug description: HTTP HEAD request executes entire script Maybe this is the way it's supposed to work, but it doesn't make a whole lot of sense to me. When processing a HEAD request, mod_php executes the script as if it were a normal GET request. This is unexpected (at least to me) and can lead to unexpected results, such as duplicate execution when dealing with browsers that use a HEAD request prior to a GET request. For example, test script test.php: <?php $fp = fopen("test.out", "a"); fputs($fp, "I'm hit!"); fclose($fp); ?> and assuming test.out exists and is world-writable. HEAD /test.php HTTP/1.0 causes the file test.out to be appended to. This is not what I would expect, but maybe it's unavoidable. A workaround is to look at $_SERVER['REQUEST_METHOD'] and do nothing if it's a HEAD request. './configure' '--with-apxs=/usr/local/sbin/apxs' '--with-config-file-path=/usr/local/etc' '--enable-versioning' '--with-system-regex' '--disable-debug' '--enable-track-vars' '--without-gd' '--without-mysql' '--with-zlib' '--with-mcrypt=/usr/local' '--with-mysql=/usr/local' '--prefix=/usr/local' 'i386--freebsd4.5' -- Edit bug report at http://bugs.php.net/?id=15693&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15693&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15693&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15693&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15693&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15693&r=support Expected behavior: http://bugs.php.net/fix.php?id=15693&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15693&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15693&r=submittedtwice

« previous php.bugs (#877) next »