ID:               49340
 Updated by:       sjo...@php.net
 Reported By:      alexmontoanelli at gmail dot com
 Status:           Open
 Bug Type:         PCNTL related
 Operating System: Linux
 PHP Version:      5.2.10
 New Comment:

Thank you for your bug report.

I don't fully understand the problem.

Is the problem that you have to hit enter for the signal handler to
run? Or that the line with 'echo $foo' is ran after the fgets?


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

[2009-08-23 22:12:28] alexmontoanelli at gmail dot com

Description:
------------
After executions of certain functions,
the handler configured by
posix_singal, are not called where the 
funcion are in execution - like freads.

Reproduce code:
---------------
#!/usr/bin/php
<?php

declare(ticks = 1);

function handler($a){
    echo "Calling handler on signal :  $a\n";
}

//define handlers for signals
pcntl_signal(SIGTERM, 'handler');
pcntl_signal(SIGINT, 'handler');

//if you send a signal, the function fgets are waiting for a user
input, he is not called, until you enter something
$foo = fgets(STDIN);

echo $foo;


Expected result:
----------------
alexmm tmp # php a.php 
^C
Calling handler on signal :  2


Actual result:
--------------
alexmm tmp # php a.php 
^C MY_INPUT_AFTER_SEND_CTRL_C
Calling handler on signal :  2
 MY_INPUT_AFTER_SEND_CTRL_C


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


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

Reply via email to