Bug #77828 [Com]: SplFileObject::seek problems on custom stream wrappers
| From: | Booker82EVail at gmail dot com | Date: | Wed, 14 Feb 2024 06:28:01 +0000 |
| Subject: | Bug #77828 [Com]: SplFileObject::seek problems on custom stream wrappers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-246454@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77828&edit=1
ID: 77828
Comment by: Booker82EVail at gmail dot com
Reported by: alexey dot khokhryakov at gmail dot com
Summary: SplFileObject::seek problems on custom stream
wrappers
Status: Open
Type: Bug
Package: SPL related
PHP Version: 7.2.16
Block user comment: N
Private report: N
New Comment:
This post is very informatic for me so thank you so much for creating this topic
best regard,
(https://github.com)(https://www.dogneedsbest.com/)
Previous Comments:
------------------------------------------------------------------------
[2022-12-01 06:10:15] gallwaseborg at gmail dot com
If you truly need to say thank you ! We'd really appreciate and be thankful expecting you leave
a decent report on the module page. This is the best procedure for guiding say thank you to this
undertaking and sponsorship bundle. (https://www.subwayliveiq.net/)github.com
------------------------------------------------------------------------
[2019-04-01 08:36:03] requinix@php.net
I know it's not correct. I'm saying, you can see the line reading/byte reading behavior if
you switch the stream to read lines. There is a bug here.
------------------------------------------------------------------------
[2019-04-01 08:21:36] alexey dot khokhryakov at gmail dot com
I tried and I see that my test script works but it breaks SplFileObject::fread() functionality as I
said.
file_put_contents($tmpFilename = tempnam(sys_get_temp_dir(), 'test'),
"one\r\ntwo\r\n");
stream_wrapper_register('foo', FooStreamWrapper::class);
$file = new SplFileObject("foo:/{$tmpFilename}", 'r');
var_dump($file->fread($file->getSize()));
Expected:
string(10) "one
two
"
Actual:
string(5) "one
"
------------------------------------------------------------------------
[2019-04-01 08:12:40] requinix@php.net
Try the change I said, see what happens.
------------------------------------------------------------------------
[2019-04-01 07:38:58] alexey dot khokhryakov at gmail dot com
requinix@php.net, I don't think so.
If wrapper::stream_read() proxies calls to fgets() then SplFileObject::fread($count) becomes
inconsistent because PHP's file wrapper returns $count of data including linebreaks.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=77828
--
Edit this bug report at https://bugs.php.net/bug.php?id=77828&edit=1