From: xuefer at 21cn dot com
Operating system: linux
PHP version: 4.3.4
PHP Bug Type: Filesystem function related
Bug description: signals make STDIN become EOF
Description:
------------
code
shell> ./test.php
don't press CTRL+D to end input. but program exists in 3 seconds because
feof() return true
uncomment line 7 will works ok, exit only when i press CTRL+D
Reproduce code:
---------------
file ./test.php:
#!/usr/bin/php
<?php
function sig_handler($signo) {
global $stdin;
print "Caught SIGALM...\n";
pcntl_alarm(3);
// line7 // $stdin = fopen("php://stdin", 'r') or die('1');
}
print "Installing signal handler...\n";
pcntl_signal(SIGALRM, "sig_handler");
print "Generating signal SIGTERM to self...\n";
declare(ticks=1);
pcntl_alarm(3);
$stdin = fopen("php://stdin", 'r') or die('1');
while (!feof($stdin)) {
echo fgets($stdin);
}
print "Done\n"
?>
--
Edit bug report at http://bugs.php.net/?id=26838&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26838&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26838&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26838&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26838&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26838&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26838&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26838&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26838&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26838&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26838&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26838&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26838&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26838&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26838&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26838&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26838&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26838&r=float