ID: 32987 User updated by: max at tehnomir dot com dot ua Reported By: max at tehnomir dot com dot ua Status: Bogus Bug Type: Filesystem function related Operating System: Linux 2.4.29 -PHP Version: 4.3.10 +PHP Version: 4.3.11 New Comment:
This bug is also in new php 4.3.11 Previous Comments: ------------------------------------------------------------------------ [2005-05-10 00:47:07] [EMAIL PROTECTED] Thank you for taking the time to report a problem with PHP. Unfortunately you are not using a current version of PHP -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. ------------------------------------------------------------------------ [2005-05-09 17:00:16] max at tehnomir dot com dot ua Description: ------------ Hello! The fgetcsv() function do not working properly. Below there is a fragment of the source data file. ----------------source data file--------------- SZ | 7784252D00000 | | 29.13 SZ | 7784265DA1000 | | 21.23 SZ | 7784265DA10PG | "Title ""V6"" | 17.9 SZ | 784270C20000 | | 29.9 SZ | 784360E00000 | | 29.41 ---------------------end data file-------------- On big input files the function after line number 3 of data file need more and more memory and then crashes with trying to allocate memory. Reproduce code: --------------- #!/usr/bin/php <?php $delimiter = "|"; $data_file = fopen('price.txt','r') or die('Cannot open price.txt !'); while( !feof($data_file) ){ $buffer = fgetcsv( $data_file, 1500, $delimiter ); $buffer[0] = trim( $buffer[0] ); $buffer[1] = trim( $buffer[1] ); $buffer[2] = trim( $buffer[2] ); $buffer[3] = trim( $buffer[3] ); $tmp_file = fopen('./csv/'.$buffer[0].'.csv', 'a+'); fwrite($tmp_file, $buffer[1] . $delimiter . $buffer[2] . $delimiter . $buffer[3]."\n" ); fclose( $tmp_file ); } Expected result: ---------------- 7784252D00000||29.13 7784265DA1000||21.23 7784265DA10PG|Title "V6" | 17.9 784270C20000||29.9 784360E00000||29.41 Actual result: -------------- 7784252D00000||29.13 7784265DA1000||21.23 7784265DA10PG|Title "V6" | 17.9 SZ | 784270C20000 | | 29.9 SZ | 784360E00000 | | 29.41| ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32987&edit=1