Bug #55413 [NEW]: str_getcsv doesnt remove escape characters

From: Date: Fri, 12 Aug 2011 13:30:02 +0000
Subject: Bug #55413 [NEW]: str_getcsv doesnt remove escape characters
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-162548@lists.php.net to get a copy of this message
From:             
Operating system: ubuntu 11.04
PHP version:      5.3.6
Package:          Strings related
Bug Type:         Bug
Bug description:str_getcsv doesnt remove escape characters

Description:
------------
Escape-characters should only escape the next character if it is the
delimiter-character. The Escape character itself should then be removed
from the result.

Test script:
---------------
$line = '"A";"Some \"Stuff\"";"C"';
$token = str_getcsv($line, ';', '"', '\\');
print_r($token);

Expected result:
----------------
Array
(
    [0] => A
    [1] => Some "Stuff"
    [2] => C
)


Actual result:
--------------
Array
(
    [0] => A
    [1] => Some \"Stuff\"
    [2] => C
)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=55413&edit=1
-- 
Try a snapshot (PHP 5.4):            https://bugs.php.net/fix.php?id=55413&r=trysnapshot54
Try a snapshot (PHP 5.3):            https://bugs.php.net/fix.php?id=55413&r=trysnapshot53
Try a snapshot (trunk):              https://bugs.php.net/fix.php?id=55413&r=trysnapshottrunk
Fixed in SVN:                        https://bugs.php.net/fix.php?id=55413&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55413&r=needdocs
Fixed in release:                    https://bugs.php.net/fix.php?id=55413&r=alreadyfixed
Need backtrace:                      https://bugs.php.net/fix.php?id=55413&r=needtrace
Need Reproduce Script:               https://bugs.php.net/fix.php?id=55413&r=needscript
Try newer version:                   https://bugs.php.net/fix.php?id=55413&r=oldversion
Not developer issue:                 https://bugs.php.net/fix.php?id=55413&r=support
Expected behavior:                   https://bugs.php.net/fix.php?id=55413&r=notwrong
Not enough info:                     https://bugs.php.net/fix.php?id=55413&r=notenoughinfo
Submitted twice:                     https://bugs.php.net/fix.php?id=55413&r=submittedtwice
register_globals:                    https://bugs.php.net/fix.php?id=55413&r=globals
PHP 4 support discontinued:          https://bugs.php.net/fix.php?id=55413&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=55413&r=dst
IIS Stability:                       https://bugs.php.net/fix.php?id=55413&r=isapi
Install GNU Sed:                     https://bugs.php.net/fix.php?id=55413&r=gnused
Floating point limitations:          https://bugs.php.net/fix.php?id=55413&r=float
No Zend Extensions:                  https://bugs.php.net/fix.php?id=55413&r=nozend
MySQL Configuration Error:           https://bugs.php.net/fix.php?id=55413&r=mysqlcfg



Thread (12 messages)

« previous php.bugs (#162548) next »