#36476 [NEW]: fwrite count by 2 with img src=""
| From: | mdulay at millersville dot edu | Date: | Tue, 21 Feb 2006 14:22:10 +0000 |
| Subject: | #36476 [NEW]: fwrite count by 2 with img src="" | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-93480@lists.php.net to get a copy of this message | ||
From: mdulay at millersville dot edu
Operating system: Solaris 10/ HPUX 11
PHP version: 5.1.2
PHP Bug Type: Filesystem function related
Bug description: fwrite count by 2 with img src=""
Description:
------------
The issue occurs on both PHP4 and PHP5 and on 2 different OS, HPUX 11 and
Solaris 10. I have a simple counter that reads a file adds 1 and rewrites
the file. After a good bit of frustration I found that there was a missing
img src="" in the HTML. It didn't matter where the PHP was whether it
preceeded the HTML or was inline, the counter still added 2 each time it
was called upon. Of course I have fixed the HTML, however the tie between
a missing image and the PHP has me perplexed. The code I have attached has
been simplified the situation however the initial code was using includes
and the missing image was not easily detected.
Reproduce code:
---------------
<?
$counterfile="count.txt";
$conn=fopen($counterfile,'r');
$count=trim(fgets($conn));
echo ":".$count.":";
++$count;
fclose($conn);
$conn=fopen($counterfile,'w');
fwrite($conn,$count);
fclose($conn);
echo ":".$count.":";
?>
<html>
<body>
<img src="" >
</body>
</html>
Expected result:
----------------
A missing image with a counter that increments by 1.
Actual result:
--------------
Counter that has incremented by 2 and a missing image.
--
Edit bug report at http://bugs.php.net/?id=36476&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36476&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36476&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36476&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36476&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36476&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36476&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36476&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36476&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36476&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36476&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36476&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36476&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36476&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36476&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36476&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36476&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36476&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36476&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36476&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36476&r=mysqlcfg