ID:               41201
 Comment by:       tvdijen at planet dot nl
 Reported By:      rganogork at gmail dot com
 Status:           Assigned
 Bug Type:         Streams related
 Operating System: Gentoo Linux
 PHP Version:      5.2.1
 Assigned To:      pollita
 New Comment:

I have the exact same problem on Windows XP, PHP 5.2.4
The same thing seems to happen with fread()...


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

Reply via email to