#41201 [NEW]: fgets($stdin) does not return after newline if $stdin is filtered
| From: | rganogork at gmail dot com | Date: | Thu, 26 Apr 2007 13:24:55 +0000 |
| Subject: | #41201 [NEW]: fgets($stdin) does not return after newline if $stdin is filtered | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-111949@lists.php.net to get a copy of this message | ||
From: rganogork at gmail dot com
Operating system: Gentoo Linux
PHP version: 5.2.1
PHP Bug Type: Filter related
Bug description: fgets($stdin) does not return after newline if $stdin is filtered
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 bug report at http://bugs.php.net/?id=41201&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41201&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41201&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41201&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41201&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=41201&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41201&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41201&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41201&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41201&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41201&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=41201&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=41201&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41201&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41201&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41201&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41201&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41201&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41201&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41201&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41201&r=mysqlcfg