Bug #79072 [Ver->Fbk]: If passed via a stream processor, the included file contents get corrupted
| From: | nikic@php.net | Date: | Mon, 06 Jan 2020 18:04:39 +0000 |
| Subject: | Bug #79072 [Ver->Fbk]: If passed via a stream processor, the included file contents get corrupted | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224739@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79072&edit=1
ID: 79072
Updated by: nikic@php.net
Reported by: morozov at tut dot by
Summary: If passed via a stream processor, the included file
contents get corrupted
-Status: Verified
+Status: Feedback
Type: Bug
Package: Streams related
Operating System: Linux
PHP Version: 7.4.1
Block user comment: N
Private report: N
New Comment:
I'd say the code is incorrect. You are modifying the stream contents, but still report the old
file size in your stream_stat() override. You need to adjust the size there to account for the
modification made by the stream filter, or else report the stream as un-statable.
PS: Your use of stream filters here seems unnecessary. I would recommend you to simply open a
php://temp stream instead of dealing with that.
Previous Comments:
------------------------------------------------------------------------
[2020-01-06 16:52:59] morozov at tut dot by
Description:
------------
There are some undocumented changes in PHP 7.4 which make the stream filter that worked on PHP 7.3
and earlier not work on PHP 7.4.
Specifically, if an included file contents are passed through a stream filter, the file contents get
corrupted (assumingly, truncated) resulting in a parse error.
It is impossible to reproduce the issue using a single file, so there's a repository dedicated
to reproducing the issue: https://github.com/janvernieuwe/php-vcr-debug.
Interestingly, if the classes are included in the same file as the code using them, the issue is
_not_ reproducible.
Test script:
---------------
Cannot include the files since the bug tracker detects them as spam.
Expected result:
----------------
No error
Actual result:
--------------
PHP Parse error: syntax error, unexpected end of file in IncludeFile.php on line 7
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79072&edit=1