Bug #78850 [NEW]: PHP Version 7.2.3 - fseek
| From: | david dot wildermoth at yandex dot com | Date: | Thu, 21 Nov 2019 09:51:10 +0000 |
| Subject: | Bug #78850 [NEW]: PHP Version 7.2.3 - fseek | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-223826@lists.php.net to get a copy of this message | ||
From: david dot wildermoth at yandex dot com
Operating system: Widows 10
PHP version: 7.2.24
Package: Program Execution
Bug Type: Bug
Bug description:PHP Version 7.2.3 - fseek
Description:
------------
---
https://www.php.net/manual/en/function.fseek.php
---
This "fseek" coding has a malfunction:-
$record = fopen("C:xampp/htdocs/application/views/record.php", "r+");
fseek($record, 200); //fseek malfunctions
$gm = gmdate("\nd M Y H:i T");
fwrite($record, $gm);
$ad = (" - $advertiser") . "<br>";
fwrite($record, $ad);
That producers a result similar to the following:-
21 Nov 2019 - 14:38 GMT - chris<br>
Which is 35 bytes or thereabouts. That is OK for the first record, but
if there exists a previous record, then that previous record will be
overwritten which is what I don't want.
If I advance (by white space) a previous record by about 35-40 bytes the
new record will print plus consume an additional 35 odd bytes, and that
previous record moves 35 bytes closer to the new record. I want to avoid
that extra consumption.
I want the output to consume only the bytes of its length, no more.
If I insert "a" which takes the pointer to the end, everything works but
the output is "recent at the bottom" whereas I want "recent at the top"
hence using "r+" and "fseek".
I have read the PHP manual on fseek() and fwrite() and others but there
is nothing suggesting a consumption limitation, or similar. I've also
tried various addins but nothing has worked.
Expected result:
----------------
I want the output to consume only the bytes of its length, no more.
--
Edit bug report at https://bugs.php.net/bug.php?id=78850&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78850&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78850&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78850&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78850&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78850&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78850&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78850&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78850&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78850&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78850&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78850&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78850&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78850&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78850&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78850&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78850&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78850&r=mysqlcfg