[php-src] Issue #8219: Stream Wrapper + Stream Filter cannot longer alter PHP file since PHP 7.4
| From: | cmb69 | Date: | Mon, 21 Mar 2022 11:58:12 +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-240430@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8219
Comment Author: cmb69
[PHP 7.4 is no longer actively supported](https://www.php.net/supported-versions.php), but I can
reproduce the reported behavior with PHP-8.0. However, this is not a bug in PHP, but rather a bug in
the userland script. In
StreamFilter::filter(), $consumed needs to be
increased by the length of the modified stream contents; you can easily verify that by changing
StreamFilter::doFilter():
````
$buffer = str_replace("foobar", "foob_$rand", $buffer);
````