|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14537 fgetc fails to return single charachter immediatly
Submitted: 2001-12-15 15:38 UTC Modified: 2002-08-23 21:53 UTC
From: junk-php at aontic dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.1.0 OS: Linux 2.4.7-10smp i686
Private report: No CVE-ID: None
 [2001-12-15 15:38 UTC] junk-php at aontic dot com
fgetc should have at least the option of returning a single charachter immediatly upon its entry, or another function should be defined (such as getchar()) that achieves similar functionality to fgetc(stdin) which return a single charachter immediatly. 

The following script allows the user to type more than a single charachter and only returns when the user hits enter. fgetc should simply block until a single charachter is entered and then return. 

This is missing functionality that can not be worked around easily as far as I can tell. 


$fp = fopen("php://stdin", "r");
$char = fgetc($fp);
echo $char;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-15 22:23 UTC]
Please search bug database before report.
This has been reported ;)
 [2001-12-16 05:46 UTC]
Duplicate of Bug id #14003

 [2002-08-23 21:53 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jun 22 14:01:23 2021 UTC