php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18350 PHP script executed twice
Submitted: 2002-07-15 09:01 UTC Modified: 2002-07-16 09:12 UTC
From: jobartim at voila dot fr Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.2.1 OS: Linux
Private report: No CVE-ID: None
 [2002-07-15 09:01 UTC] jobartim at voila dot fr
Here is the script which gives problems, this script delete the lines number $i where $tab[$i] == "on"
$fp  = fopen($file,"r");
$fp2 = fopen("$file.tmp","w");

$i = 0;
while($line = fgets($fp,4096))
{
	if ($tab[$i] != "on")
		fwrite($fp2,$line);
	$i++;
}

fclose($fp2);
fclose($fp);
rename("$file.tmp",$file);

This script is called by a post form.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-15 09:07 UTC] jobartim at voila dot fr
I just forget to say what is exactly the bug : the script executes twice so it deletes 2 lines when I want only one to be deleted ...
 [2002-07-15 09:11 UTC] hholzgra@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.
 [2002-07-15 09:31 UTC] jobartim at voila dot fr
I really think that it is a bug in the sense that PHP executes the script twice and I don't understand why PHP should have to execute it twice !!!
 [2002-07-15 11:48 UTC] hholzgra@php.net
wanna bet? ;)

are you really *sure* that your code is correct?
have you put an error_log() statement on top of it
and verified that the log message appears twice in your error log?

with the code fragment you pasted it is not possible
to reproduce what you are doing, but the code looks
rather suspicious...
e.g. where is $tab defined and what is it's content?




 [2002-07-15 20:26 UTC] sniper@php.net
Check your html. There are reports in this bug database about this already, and they've always been solved by fixing
the HTML...

 [2002-07-16 03:58 UTC] jobartim at voila dot fr
Is it possible to know which are the report about this in the database in order I fix my html ?
 [2002-07-16 04:13 UTC] jobartim at voila dot fr
OK everything is good it was only my form which was was posted twice at the same time...
Excuse me for the time it takes to you
 [2002-07-16 09:12 UTC] sniper@php.net
"I told you so.." :)

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 21:00:01 2026 UTC