From:             [EMAIL PROTECTED]
Operating system: Redhat 7.3 i386
PHP version:      4CVS-2002-10-03
PHP Bug Type:     Filesystem function related
Bug description:  SAPI-CLI fread/fgets on STDIN problem

In trying to take user input from Shell in the last two CVS snapshots using
the SAPI-CLI, the following program [and many variations thereof] hang on
STDIN [basically it takes unlimited input as if its not recognizing EOL].
This is under an Pentium-2, Redhat 7.3 with the latest glibc library off
Redhat's update site.

<?php
function getInput($length)
  {
            $fr = fopen("php://stdin", "r");
            $input = fgets($fr, $length);
            $input = rtrim($input);
            fclose($fr);
            return $input;
  }
echo "Enter some text (10 char max): ";
$text = getInput(10);
echo "You entered: $text\n";

?>

This program works fine on an older php CGI style binary but does not work
under the current snapshot. Have also tried the manual suggestion of using
the new constant STDIN and that causes the same behavior - hence my
suspicion this is a bug.

Here is the modules compiled in

[root@league league]# php -m
[PHP Modules]
xml
tokenizer
standard
sockets
session
posix
pcre
pcntl
overload
mysql
mbstring
gd
ctype
zlib

[Zend Modules]


-- 
Edit bug report at http://bugs.php.net/?id=19746&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=19746&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=19746&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=19746&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=19746&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=19746&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=19746&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=19746&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=19746&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=19746&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=19746&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=19746&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=19746&r=dst

Reply via email to