Bug #72330 [NEW]: str_getcsv() splits fields incorrectly if escape char flollowed by UTF chars

From: Date: Fri, 03 Jun 2016 16:00:45 +0000
Subject: Bug #72330 [NEW]: str_getcsv() splits fields incorrectly if escape char flollowed by UTF chars
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201436@lists.php.net to get a copy of this message
From: cronfy at gmail dot com Operating system: Linux Mint 17.1 Rebecca PHP version: Irrelevant Package: Strings related Bug Type: Bug Bug description:str_getcsv() splits fields incorrectly if escape char flollowed by UTF chars Description: ------------ When escape character set for str_getcsv() is followed by some UTF characters, string is parsed incorrectly. I tested it on php 5.4, 5.5, 5.6 and 7.0 - behavior is the same. Test script: --------------- $utf_1 = chr(0xD1) . chr(0x81); // U+0440; $utf_2 = chr(0xD8) . chr(0x80); // U+0600 $string = '"first #' . $utf_1 . $utf_2 . '";"second one"'; $d = str_getcsv($string, ';', '"', "#"); print_r($d); Expected result: ---------------- Array ( [0] => first #с؀ [1] => second one ) Actual result: -------------- Array ( [0] => first #с؀";second one" ) -- Edit bug report at https://bugs.php.net/bug.php?id=72330&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72330&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72330&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72330&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72330&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72330&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72330&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72330&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72330&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72330&r=support Expected behavior: https://bugs.php.net/fix.php?id=72330&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72330&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72330&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72330&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72330&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72330&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72330&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72330&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72330&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72330&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72330&r=mysqlcfg

« previous php.bugs (#201436) next »