[php-src] Issue #12400: stream_filter_remove does not get rid of filter
| From: | apreiml | Date: | Tue, 10 Oct 2023 12:50:48 +0000 |
| Subject: | [php-src] Issue #12400: stream_filter_remove does not get rid of filter | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245535@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12400
Author: apreiml
### Description
The following code:
```php
<?php
$mem = fopen('php://memory', 'r+');
$filter = stream_filter_append($mem, 'string.rot13');
fwrite($mem, "asdf");
stream_filter_remove($filter);
rewind($mem);
echo stream_get_contents($mem);
```
Resulted in this output:
```
asdf
```
because the rot13 filter is applied again after rewind during stream_get_contents.
But I expected this output instead:
```
nfqs
```
### PHP Version
PHP 8.2.11
### Operating System
Arch Linux