#26838 [Opn->Bgs]: signals make STDIN become EOF
| From: | iliaa@php.net | Date: | Fri, 09 Jan 2004 01:35:02 +0000 |
| Subject: | #26838 [Opn->Bgs]: signals make STDIN become EOF | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-53015@lists.php.net to get a copy of this message | ||
ID: 26838
Updated by: iliaa@php.net
Reported By: xuefer at 21cn dot com
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: linux
PHP Version: 4.3.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
signals can and will interrupt readings from files &
sockets.
Previous Comments:
------------------------------------------------------------------------
[2004-01-08 05:50:30] xuefer at 21cn dot com
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 this bug report at http://bugs.php.net/?id=26838&edit=1