#40951 [Opn]: combination of header() and imagegif/png/jpeg() makes script run more than once

From: Date: Thu, 29 Mar 2007 17:57:30 +0000
Subject: #40951 [Opn]: combination of header() and imagegif/png/jpeg() makes script run more than once
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110939@lists.php.net to get a copy of this message
ID: 40951 User updated by: zirephoenix at rogers dot com Reported By: zirephoenix at rogers dot com Status: Open Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.4.6 New Comment: This bug was only for FireFox 1.5.x. Seems to be gone in 2. Previous Comments: ------------------------------------------------------------------------ [2007-03-29 17:25:49] zirephoenix at rogers dot com Description: ------------ Without the header() and imagegif() functions, the code is basically a hit counter script. However, with the combination of those two lines of code, the hit counter will increment by 2. Something is causing the script to run twice. Reproduce code: --------------- <?php $site="test.txt"; $imageFile="image/metro.gif"; $hits=0; if (file_exists($site)) { $temp=file($site); $hits=$temp[0]; } $hits++; $fileHandle=fopen($site, "w"); fputs($fileHandle, $hits); fclose($fileHandle); header("Content-type: image/gif"); imagegif(imagecreatefromgif($imageFile)); ?> Expected result: ---------------- test.txt should increment by 1 every time the script is accessed Actual result: -------------- test.txt increments by 2 every time the script is accessed ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40951&edit=1

« previous php.bugs (#110939) next »