|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45356
Submitted: 2008-06-25 17:45 UTC Modified: 2008-07-27 01:00 UTC
Avg. Score:4.6 ± 0.6
Reproduced:10 of 10 (100.0%)
Same Version:3 (30.0%)
Same OS:9 (90.0%)
From: al at txtlocal dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-06-25 17:45 UTC] al at txtlocal dot com


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-25 17:46 UTC] al at txtlocal dot com

 [2008-06-25 18:08 UTC] al at txtlocal dot com

 [2008-07-19 17:50 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

I'm unable to reproduce it with a simple scripts neither with 5.2.6 nor with 5.3.0-dev.
 [2008-07-27 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-09-08 19:04 UTC] mk at kurznet dot com

 [2008-09-08 22:06 UTC] sfschiller at gmail dot com
based on [mk at kurznet dot com]

a change of the locale information helps.


setting the locale information to a unicode or UTF locale names will lose the first letters.
 [2011-08-19 13:15 UTC] gtisza at gmail dot com
fgetcsv() seems to throw the first character away if it is invalid in the current locale, but ignores invalid characters which are not at the beginning of a cell. This code reproduces the problem in PHP 5.3.6:


$utfchar = chr(0xC3).chr(0x89); // U+009C in UTF-8

$csv = $utfchar."x".$utfchar."x\n";

file_put_contents('test.csv', $csv);
$file = fopen('test.csv', 'r');
$data = fgetcsv($file);

for ($i = 0; $i < strlen($data[0]); $i++) {
    echo dechex(ord($data[0][$i])).' ';
echo "\n";

// expected: c3 89 78 c3 89 78 - "ÉxÉx"
// actual: 78 c3 89 78 - "xÉx"


I agree with the commenter in bug 12127 that a CSV function should not mess with encodings in the first place, just copy the content byte-by-byte.
 [2012-06-19 14:36 UTC] info at johanneshoppe dot com
This happens to every NON ASCII char as the first char in a cell.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Mon Jun 25 07:01:48 2018 UTC