|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80080 stream_get_contents is never completed
Submitted: 2020-09-09 09:22 UTC Modified: -
From: clark at electrobeat dot dk Assigned:
Status: Open Package: Sockets related
PHP Version: 7.3.22 OS: Debian 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: clark at electrobeat dot dk
New email:
PHP Version: OS:


 [2020-09-09 09:22 UTC] clark at electrobeat dot dk
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

Test script:
$syntax = '/var/bin/poppler-0.79.0/build/utils/pdftops file.pdf';

$pipes = [];
$process = proc_open($syntax, [
	0 => ['pipe', 'r'],	// stdin
	1 => ['pipe', 'w'],	// stdout
	2 => ['pipe', 'w']	// stderr
], $pipes);

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){

$exitcode = proc_close($process);

echo "err: $stderr\n";
echo "out: $output\n";

Expected result:
output done
err done

Actual result:


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Oct 22 10:03:33 2021 UTC