Bug #80080 [NEW]: stream_get_contents is never completed

From: Date: Wed, 09 Sep 2020 09:22:42 +0000
Subject: Bug #80080 [NEW]: stream_get_contents is never completed
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228946@lists.php.net to get a copy of this message
From: clark at electrobeat dot dk Operating system: Debian 10 PHP version: 7.3.22 Package: Sockets related Bug Type: Bug Bug description:stream_get_contents is never completed Description: ------------ Sometimes I experience that stream_get_contents never completes executing In this case a PDF file is processed via poppler's pdftops. The PDF contains some errors though but when running the command directly in a terminal it completes and returns The code only prints "opened" but never reach "ouput done" The PDF can be found here https://docdro.id/fHlIxBS Test script: --------------- $syntax = '/var/bin/poppler-0.79.0/build/utils/pdftops file.pdf file.ps'; $pipes = []; $process = proc_open($syntax, [ 0 => ['pipe', 'r'], // stdin 1 => ['pipe', 'w'], // stdout 2 => ['pipe', 'w'] // stderr ], $pipes); fclose($pipes[0]); echo "opened\n"; $output = stream_get_contents($pipes[1]); echo "output done\n"; $stderr = stream_get_contents($pipes[2]); echo "err done\n"; foreach($pipes as $pipe){ if(is_resource($pipe)){ fclose($pipe); } } $exitcode = proc_close($process); echo "err: $stderr\n"; echo "out: $output\n"; Expected result: ---------------- opened output done err done err: output: Actual result: -------------- opened -- Edit bug report at https://bugs.php.net/bug.php?id=80080&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80080&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80080&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80080&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80080&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80080&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80080&r=support Expected behavior: https://bugs.php.net/fix.php?id=80080&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80080&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80080&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80080&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80080&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80080&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80080&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80080&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80080&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80080&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80080&r=mysqlcfg

« previous php.bugs (#228946) next »