Csv::addStreamFilter() - Unable to locate filter bug
rafaello104 opened this issue · 3 comments
Bug Report
Information | Description |
---|---|
Version | 9.8.0 |
PHP version | 8.0.19 |
OS Platform | Alpine Linux 3.14 |
Summary
Similar issue as described in #72
Using the CSV's library Csv::addStreamFilter() gives an error unable to locate filter
whereas the fopen() and stream_filter_append() method works fine.
$reader = Reader::createFromPath($tempFile);
// This block below fails
if ($reader->supportsStreamFilterOnRead()) {
$reader->addStreamFilter('convert.iconv.ISO-8859-1.UTF-8//TRANSLIT');
}
// This block below succeeds
$stream = fopen($tempFile, 'r');
$stream2 = stream_filter_append($stream, 'convert.iconv.ISO-8859-1.UTF-8//TRANSLIT', STREAM_FILTER_READ);
I have tried using this filter with the following modifications:
- Using escaped slashes (
%2F
) - Using a slash (and escaped slash) instead of the period between the ISO & UTF formats
- Removing the
//TRANSLIT
option - Changing the
//TRANSLIT
option to//IGNORE
Expected result
No errors
Actual result
unable to locate filter "convert.iconv.ISO-8859-1.UTF-8//TRANSLIT"
- same result for all the other variants of the conversion string
@rafaello104 thanks for reporting the issue could you provide a simple reproducible script. The smaller the easiest for me to debug and fix the issue if it exists because I fail to reproduce it myself.
The described error should only occurs if the $path
is not internally converted to a stream by the package.
@rafaello104 Was the type of the variable $stream2
from your example a resource? I could only recreate the behavior if I disable the iconv extension. In this case $stream2
was false
for me. However, no error is thrown.
closing the issue until further information is given by its author