From: scope at planetavent dot de Operating system: Windows Server 2008 / RHEL 6.2 PHP version: 5.3.17 Package: Streams related Bug Type: Bug Bug description:stream_get_line return contains delimiter string
Description: ------------ On specific file input stream_get_line returns a "line" that actually contains the delimiter. PHP 5.3.10 does not show this problem, PHP versions from 5.3.11 to 5.3.17 do. PHP 5.4.7 seems to be affected as well. Bug #44607 seems to be related, but was fixed long time ago. Test script: --------------- <?php $file = __DIR__ . '/input_dummy.txt'; $data = str_repeat( '.', 8184 ) . 'MM' . str_repeat( '.', 8190 ) . 'MM' . str_repeat( '.', 8128 ) . 'MM' . str_repeat( '.', 61 ) . 'MM' . str_repeat( '.', 20 ); file_put_contents( $file, $data ); $fh = fopen( $file, "rb" ); $delimiter = "MM"; while ( !feof( $fh ) ) { $before = ftell( $fh ); $line = stream_get_line( $fh, 4096, $delimiter ); $after = ftell( $fh ); if ( strpos( $line, $delimiter ) !== false ) { echo "found delimiter in return! ($before / $after)\n$line"; exit; } } echo "ok\n"; Expected result: ---------------- ok Actual result: -------------- found delimiter in return! (24508 / 24591) .............................................................MM.................... -- Edit bug report at https://bugs.php.net/bug.php?id=63240&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63240&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63240&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63240&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63240&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63240&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63240&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63240&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63240&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63240&r=support Expected behavior: https://bugs.php.net/fix.php?id=63240&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63240&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63240&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63240&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63240&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63240&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63240&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63240&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63240&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63240&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63240&r=mysqlcfg