#49168 [NEW]: fgetcsv closure missbehaves when using '§' as closure
| From: | axel77 at gmail dot com | Date: | Wed, 05 Aug 2009 10:33:56 +0000 |
| Subject: | #49168 [NEW]: fgetcsv closure missbehaves when using '§' as closure | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-140676@lists.php.net to get a copy of this message | ||
From: axel77 at gmail dot com
Operating system: Ubuntu Linux
PHP version: 5.2.10
PHP Bug Type: Filter related
Bug description: fgetcsv closure missbehaves when using '§' as closure
Description:
------------
I was using '§' as closure, since this was the only character I fairly
didn't even expect to encounter, without having to use any escaping.
It does not work. It will always add an additional trailing '§' on the
data received.
Reproduce code:
---------------
--- reproduce.php ---
<html>
<style type="text/css">
table {border-collapse: collapse;}
td {border: 1px solid;}
</style>
<body><table><tbody>
<?php
if (($handle = fopen('data', 'r')) === FALSE) {
echo '<h1>ERROR: Unable to read data.</h1>';
exit;
}
while (($data = fgetcsv($handle, 1000, ',', '§')) !== FALSE) {
echo "<tr><td>$data[0]</td>";
echo "<td>$data[1]</td>";
echo "<td>$data[2]</td></tr>";
}
fclose($handle);
?>
</tbody></table></body></html>
-----------------
--- data ---
abm, §anjn an§, aaa
abm, anjn an, aaa
-----------------
Expected result:
----------------
abm | anjn an | aaa
abm | anjn an | aaa
Actual result:
--------------
abm | anjn an§ | aaa
abm | anjn an | aaa
--
Edit bug report at http://bugs.php.net/?id=49168&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49168&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49168&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49168&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49168&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49168&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49168&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49168&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49168&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49168&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49168&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49168&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49168&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49168&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49168&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49168&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49168&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49168&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49168&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49168&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49168&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49168&r=mysqlcfg