Bug #77927 [NEW]: popen() merge two consequent lines from stream (for big streams 1Mb or above)

From: Date: Sat, 20 Apr 2019 11:46:31 +0000
Subject: Bug #77927 [NEW]: popen() merge two consequent lines from stream (for big streams 1Mb or above)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220532@lists.php.net to get a copy of this message
From: alexeykirpa at gmail dot com Operating system: Windows 7+ PHP version: 7.2.17 Package: Streams related Bug Type: Bug Bug description:popen() merge two consequent lines from stream (for big streams 1Mb or above) Description: ------------ Initially I found problem when use popen() to process output of utility which produce CSV data (LogParser 2.2 if exactly). For 5MB stream usually 4..7 lines is bad. I redirect utility result to file and use fopen() - everything works correct. When I use "popen("type filename") - got same errors as with original utility output. Tested with php 7.2.12+ and with 7.3.x - same problem. NOTICE: with php 5.6.13 all works fine. Source file "MyTest.csv" which can be used to reproduce error you may download from url: http://www.sparc.tm/alex/mytest.rar Test script: --------------- <?php $fn = popen("type MyTest.csv", 'r'); // $fn = fopen("MyTest.csv", "r"); // this works! while (($data = fgetcsv($fn)) !== FALSE) { if (count($data) != 4) // CSV file always contain 4 columns { echo '[bad line] - ' . implode('; ', $data) . "\n"; continue; } } pclose($fn); -- Edit bug report at https://bugs.php.net/bug.php?id=77927&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77927&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77927&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77927&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77927&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77927&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77927&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77927&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77927&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77927&r=support Expected behavior: https://bugs.php.net/fix.php?id=77927&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77927&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77927&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77927&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77927&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77927&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77927&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77927&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77927&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77927&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77927&r=mysqlcfg

« previous php.bugs (#220532) next »