Bug #1428: file_exists(), filesize() and while(1) loops
| From: | brettw at cs dot rmit dot edu dot au | Date: | Thu, 20 May 1999 02:22:31 +0000 |
| Subject: | Bug #1428: file_exists(), filesize() and while(1) loops | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5802@lists.php.net to get a copy of this message | ||
From: brettw@cs.rmit.edu.au
Operating system: FreeBSD-3.1R
PHP version: 3.0.7
PHP Bug Type: Misbehaving function
Bug description: file_exists(), filesize() and while(1) loops
while(1){
if(file_exists("tick")){
exec("mv tick tock");
}else{
pritnf("Not my turn\n");
}
The problem that occurs is that if tick doesn't exists when the script is started, it
works fine (continually outputs "Not my turn"). But when the script is started and
tick exists, on the first iteration tick is moved to tock, but in subsequent iterations
it still thinks that tick exists and tries to move it again, giving the system error
mv: cannot access tick.
The same sort of thing occurs with if(filesize("tasks.log")==0){...}. If tasks.log
is on the first iteration if filesize is zero, then the statements in the if are executed.
When I then edit tasks.log so that it has data in it (that is it's size is > 0), on
subsequent iterations filesize("tasks.log")==0 is still true.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net