Bug #81284 [NEW]: str_getcsv cant parse with multibyte delimiter
| From: | mx03 at volny dot cz | Date: | Fri, 23 Jul 2021 13:01:13 +0000 |
| Subject: | Bug #81284 [NEW]: str_getcsv cant parse with multibyte delimiter | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-235306@lists.php.net to get a copy of this message | ||
From: mx03 at volny dot cz
Operating system:
PHP version: Irrelevant
Package: Strings related
Bug Type: Bug
Bug description:str_getcsv cant parse with multibyte delimiter
Description:
------------
Separator can be only one character that is not multibyte.
if setlocale is utf8, it cant parse the csv:
https://3v4l.org/MiD3B
if setlocale is not utf8, it parses the string, but the result has the 2
additional bytes:
https://3v4l.org/ohc4Q
Test script:
---------------
setlocale(LC_CTYPE, "en_US.UTF-8");
$test = "â¤";
$line = "test1â¤test2â¤test3";
$header = str_getcsv($line, $test);
var_dump($header);
Expected result:
----------------
array(3) {
[0]=>
string(5) "test1"
[1]=>
string(7) "test2"
[2]=>
string(7) "test3"
}
Actual result:
--------------
array(1) {
[0]=>
string(21) "test1â¤test2â¤test3"
}
--
Edit bug report at https://bugs.php.net/bug.php?id=81284&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81284&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81284&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81284&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81284&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81284&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81284&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81284&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81284&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81284&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81284&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81284&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81284&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81284&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81284&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81284&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81284&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81284&r=mysqlcfg