php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36476 fwrite count by 2 with img src=""
Submitted: 2006-02-21 15:22 UTC Modified: 2006-02-21 23:12 UTC
From: mdulay at millersville dot edu Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.1.2 OS: Solaris 10/ HPUX 11
Private report: No CVE-ID: None
 [2006-02-21 15:22 UTC] mdulay at millersville dot edu
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-21 23:12 UTC] mike@php.net
Sorry, but 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 as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 03 08:01:31 2024 UTC