[php-src] Issue #8219: Stream Wrapper + Stream Filter cannot longer alter PHP file since PHP 7.4
| From: | cmb69 | Date: | Mon, 21 Mar 2022 16:17:32 +0000 |
| Subject: | [php-src] Issue #8219: Stream Wrapper + Stream Filter cannot longer alter PHP file since PHP 7.4 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240441@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8219
Comment Author: cmb69
Okay, I had a closer look, and found that the behavioral change has been introduced by
c2c5c9a973559b7ba9f84337c5f8078e59e98a91. So the problem with the existing code is actually the
StreamWrapper::stream_stat() implementation. At least the size needs to
properly match the filtered output. Quick fix for the given script:
````.php
public function stream_stat(): array
{
$stat = fstat($this->resource);
$stat["size"] = $stat["size"] + 4;
return $stat;
}
````
Of course, that won't work in practice; instead the code needs to track the actual size.