note 128526 added to splfileinfo.getsize
| From: | "PawelB dot " at main dot php dot net | Date: | Thu, 11 May 2023 08:41:36 +0000 |
| Subject: | note 128526 added to splfileinfo.getsize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220481@lists.php.net to get a copy of this message | ||
When getSize return 0, after fwrtite, You must use clearstatcache:
$tmpFile = new \SplFileObject('/tmp/file.txt');
$fp = $tmpFile->openFile('w');
$fp->fwrite('123');
$fp->fflush();
echo $fp->getSize(); //Return 0
clearstatcache();
echo $fp->getSize(); //Return 3
https://bugs.php.net/bug.php?id=72182
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 46.77.90.92)
----
Manual Page -- https://php.net/manual/en/splfileinfo.getsize.php
Edit -- https://main.php.net/note/edit/128526
Del: integrated -- https://main.php.net/note/delete/128526/integrated
Del: useless -- https://main.php.net/note/delete/128526/useless
Del: bad code -- https://main.php.net/note/delete/128526/bad+code
Del: spam -- https://main.php.net/note/delete/128526/spam
Del: non-english -- https://main.php.net/note/delete/128526/non-english
Del: in docs -- https://main.php.net/note/delete/128526/in+docs
Del: other reasons-- https://main.php.net/note/delete/128526
Reject -- https://main.php.net/note/reject/128526
Search -- https://main.php.net/manage/user-notes.php