#49966 [NEW]: fputcsv does not respect trailing zeros in number-like strings
From: shankao at gmail dot com
Operating system: Centos 5
PHP version: 5.3.1RC2
PHP Bug Type: Filesystem function related
Bug description: fputcsv does not respect trailing zeros in number-like strings
Description:
------------
You can get into problems with number-like strings.
For example, phones with trailing zeros 056033023 don't get quoted in the
generated csv file. So, a workaround for that could be add an extra space
character before the real value.
Reproduce code:
---------------
---
From manual page: function.fputcsv
---
$csv_data = array();
$csv_data[] = '021323123'; // Includes trailing zeros
fputcsv ($fd, $csv_data);
Expected result:
----------------
Phone field keeps trailing zeros
Actual result:
--------------
Phone field gets zeros removed cause interpreted as integer instead of
string
--
Edit bug report at http://bugs.php.net/?id=49966&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49966&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49966&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49966&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49966&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49966&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49966&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49966&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49966&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49966&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49966&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49966&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49966&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49966&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49966&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49966&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49966&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49966&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49966&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49966&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49966&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49966&r=mysqlcfg
Thread (2 messages)
- shankao at gmail dot com