From: cschneid at cschneid dot com Operating system: PHP version: 6SVN-2009-10-09 (SVN) PHP Bug Type: Streams related Bug description: STDOUT losing data with posix_isatty()
Description: ------------ The PHP streams for stdin, stdout and stderr are seekable which results in php_stream_flush() and seek being called on it. For some reason php_stream_flush() fails to actually write the data while still calling seek and resetting the stream position. Suggested solution: - Find out why php_stream_flush() fails and fix it (I don't know enough about it) - Mark (some? all?) stdio streams as PHP_STREAM_FLAG_NO_SEEK in sapi/cli/php_cli.c (see patch) - Mark stdio streams as PHP_STREAM_FLAG_NO_SEEK in ext/standard/php_fopen_wrapper.c Reproduce code: --------------- php -r 'echo "hello1\n"; posix_isatty(STDOUT); echo "hello2\n";' >out; cat out Expected result: ---------------- hello1 hello2 Actual result: -------------- hello2 -- Edit bug report at http://bugs.php.net/?id=49819&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49819&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49819&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49819&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49819&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49819&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49819&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49819&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49819&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49819&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49819&r=support Expected behavior: http://bugs.php.net/fix.php?id=49819&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49819&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49819&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49819&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49819&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49819&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49819&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49819&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49819&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49819&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49819&r=mysqlcfg