ID:               34972
 Updated by:       [EMAIL PROTECTED]
 Reported By:      VJTD3 at VJTD3 dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         CGI related
-Operating System: Windows/Linux
+Operating System: *
-PHP Version:      5.0.5
+PHP Version:      5CVS-2005-11-09 (snap)
 Assigned To:      wez
 New Comment:

Assigned to the streams maintainer.


Previous Comments:
------------------------------------------------------------------------

[2005-11-09 20:19:26] VJTD3 at VJTD3 dot com

no change, the bug is the same.

------------------------------------------------------------------------

[2005-11-06 23:19:43] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



------------------------------------------------------------------------

[2005-10-31 16:38:53] [EMAIL PROTECTED]

Assigned to the streams maintainer.


------------------------------------------------------------------------

[2005-10-25 04:23:31] VJTD3 at VJTD3 dot com

<?php

 # Make life easier to test bothe versions
 # option:
 #  1: Yahoo HTTP example
 #  2: STDIN example.
 $test = 1;

 # note for php4 or lower:
 #  STDIN isn't a defined "constant" so uncomment this.
 #define('STDIN', fopen('php://stdin', 'r'));

 # ment to paste fread was playing with other methods and
 #  just pasted the wrong version. The result is the same.

 # notice how after the data is done it's still going and
 #  not blocked.
 if($test == '1') {
  $demo = fsockopen('yahoo.com', 80);
  stream_set_blocking($demo, FALSE);
  fwrite($demo, 'GET /'."\n\n");
  while (1) {
   $data = fread($demo, 1500);
   echo (strlen($data) ? 'read:'.$data : "\nread:".'empty'."\n");
   sleep(1);
  }
 }

 # same code with fread and blocked reguardless of setting
 #  to nonblocked.
 if($test == '2') {
  echo 'Watch me stall till you type enter I\'m blocking you!'."\n";
  stream_set_blocking(STDIN, FALSE);
  while (1) {
   $data = fread(STDIN, 10);
   # I do know I could use trim, but if blocking was
   #  working it will act weird if it's mid of a end of
   #  line.
   $data = str_replace("\n", '', $data);
   $data = str_replace("\r", '', $data);
   echo (strlen($data) ? 'read:'.$data : "\nread:".'empty'."\n");
   sleep(1);
  }
 }

 # stream_select() can't be used, when i try the file
 #  descriptor just gets locks and all future selects won't
 #  work. and there is no reason to even select i know what
 #  resource to monitor i just need blocking to stop so i
 #  can monitor and process as i need just liek in the
 #  yahoo http example.

?>

------------------------------------------------------------------------

[2005-10-25 01:26:58] [EMAIL PROTECTED]

FYI, using fgets() with a non-blocking resource makes no sense.

To implement what you're after, use stream_select() and fread(); these
work on stdin just fine.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/34972

-- 
Edit this bug report at http://bugs.php.net/?id=34972&edit=1

Reply via email to