#41201 [Opn->Asn]: fgets($stdin) does not return after newline if $stdin is filtered

From: Date: Thu, 26 Apr 2007 14:38:43 +0000
Subject: #41201 [Opn->Asn]: fgets($stdin) does not return after newline if $stdin is filtered
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111957@lists.php.net to get a copy of this message
ID: 41201 Updated by: tony2001@php.net Reported By: rganogork at gmail dot com -Status: Open +Status: Assigned Bug Type: Filter related Operating System: Gentoo Linux PHP Version: 5.2.1 -Assigned To: +Assigned To: pollita Previous Comments: ------------------------------------------------------------------------ [2007-04-26 13:24:55] rganogork at gmail dot com Description: ------------ If the input stream is filtered then fgets($stdin) does not return when newline is typed. Reproduce code: --------------- <?php class test_filter extends php_user_filter { public function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $bucket->data = strtoupper($bucket->data); $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); } return PSFS_PASS_ON; } } $stdin = fopen("php://stdin", "r"); stream_filter_register("test.23", "test_filter"); stream_filter_append($stdin, "test.23"); fgets($stdin); ?> Expected result: ---------------- Should return after newline. It does return if you comment the 2 stream... lines. Actual result: -------------- It hangs, probably waiting for more input. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41201&edit=1

« previous php.bugs (#111957) next »