|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-28 09:52 UTC] bugs dot php dot net_alex at gareis dot info
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 12:00:02 2025 UTC |
Description: ------------ Despite the correct locale settings, fgetcsv strips characters from the beginning of a field, if the field is not quoted correctly. Reproduced with PHP 5.1.2-Debian-0.1~sarge1, PHP 5.1.4-1.dotdeb.2, locales en_US, en_US.UTF-8, POSIX. NOT reproduced with PHP 5.0.5-2ubuntu1.2 (en_US.UTF-8), 5.1.4-Debian-0.1~sarge1 (en_US) Might actually not be a bug, but a documentation problem - however, i do not think this related to the similar bug reports present. Reproduce code: --------------- #!/usr/local/bin/php -Cq <?php if (is_file('temp')) die("temp!\n"); $fcontent = 'foo,?bar,?????,"?bar","?????"'; file_put_contents('temp', $fcontent); echo 'plain: '.file_get_contents('temp')."\n\nfgetcsv: "; $fp = fopen('temp', 'r'); print_r(fgetcsv($fp, 1024, ',', '"')); fclose($fp); unlink('temp'); ?> Expected result: ---------------- plain: foo,?bar,?????,"?bar","?????" fgetcsv: Array ( [0] => foo [1] => ?bar [2] => ????? [3] => ?bar [4] => ????? ) Actual result: -------------- plain: foo,?bar,?????,"?bar","?????" fgetcsv: Array ( [0] => foo [1] => bar [2] => [3] => ?bar [4] => ????? )