go to bug id or search bugs for
In this code is file pointer changed in PHP 7.3
$f = fopen('test', 'w');
ftruncate($f, 2); // in 7.3 changes file pointer to 2
Should return "He\x00\x00\x00World"
Add a Patch
Add a Pull Request
I don't see any change in behavior.
You shouldn't actually see "\x00" in any output. Whether you would see anything at all for those NULs depends.
The behavioral change has been introduced with commit 9cd2d77,
and affects Windows only. Before this commit the output with
addslashes has been (and still is on Linux):
Anatol, would it be possible to restore the former behavior
without loosing the fix for bug #76422? However, it seems that
memory streams already behave like file streams on Windows now.
Maybe we should just document that ftruncate() may affect the
position of the file pointer or not.
Thanks for the ping, Christoph. I think, it's a regression and will be working on a fix.
Automatic comment on behalf of ab
Log: Fixed bug #76803 ftruncate changes file pointer
Related To: Bug #76854
Related To: Bug #77081