#34265 [NEW]: fgetcsv with length 0 work in other way than length specified

From: Date: Fri, 26 Aug 2005 06:53:30 +0000
Subject: #34265 [NEW]: fgetcsv with length 0 work in other way than length specified
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-84010@lists.php.net to get a copy of this message
From: mdv at inyourpocket dot com Operating system: Debian PHP version: 5.0.4 PHP Bug Type: Strings related Bug description: fgetcsv with length 0 work in other way than length specified Description: ------------ when length is 0 function parse strange notice "[0] => X" (there is space before X in actual result) - hexa is 0x00 simple when getting same line: fgetcsv($fd, 0, ';') != fgetcsv($fd, 4096, ';') Reproduce code: --------------- FILE (contains only 1 line for example): "X";"Y";"Zv";"Text";"H";"S";"R";"n";"I";"Ob";"P";"Roz";"Pdj" <?php $fd = fopen('file', 'r'); $t = fgetcsv($fd, 0, ';'); echo '<pre>'; var_dump($t); echo '</pre>'; ?> Expected result: ---------------- array(13) { [0]=> string(1) "X" [1]=> string(1) "Y" [2]=> string(2) "Zv" [3]=> string(4) "Text" [4]=> string(1) "H" [5]=> string(1) "S" [6]=> string(1) "R" [7]=> string(1) "n" [8]=> string(1) "I" [9]=> string(2) "Ob" [10]=> string(1) "P" [11]=> string(3) "Roz" [12]=> string(3) "Pdj" } Actual result: -------------- array(13) { [0]=> string(2) " X" [1]=> string(1) "Y" [2]=> string(2) "Zv" [3]=> string(4) "Text" [4]=> string(1) "H" [5]=> string(1) "S" [6]=> string(1) "R" [7]=> string(1) "n" [8]=> string(1) "I" [9]=> string(2) "Ob" [10]=> string(1) "P" [11]=> string(3) "Roz" [12]=> string(3) "Pdj" } -- Edit bug report at http://bugs.php.net/?id=34265&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34265&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34265&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34265&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34265&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34265&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34265&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34265&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34265&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34265&r=support Expected behavior: http://bugs.php.net/fix.php?id=34265&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34265&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34265&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34265&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34265&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34265&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34265&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34265&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34265&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34265&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34265&r=mysqlcfg

« previous php.bugs (#84010) next »