php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80513 php 7.4 pcntl_signal not catch SIGCHLD signal
Submitted: 2020-12-14 03:31 UTC Modified: 2020-12-14 03:41 UTC
From: simapple at qq dot com Assigned:
Status: Not a bug Package: PCNTL related
PHP Version: 7.4.13 OS: linux
Private report: No CVE-ID: None
 [2020-12-14 03:31 UTC] simapple at qq dot com
Description:
------------
php 7.4 pcntl_signal not catch SIGCHLD signal.swicth php 5.5 can catch.

Test script:
---------------
<?php
declare(ticks = 1); 

pcntl_signal(SIGCHLD,function($signal){
        echo "get signal $signal";
        pcntl_wait($status);
});



$pid = pcntl_fork();
if($pid == 0){ 
        echo " i am child ".getmypid();
        sleep(1);
        exit();
}

while(1){




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-14 03:41 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: Unknown/Other Function +Package: PCNTL related
 [2020-12-14 03:41 UTC] requinix@php.net
Ticks are not reliable and depend on hidden aspects of running code. A plain while(1); loop may not work.

Use pcntl_async_signals() instead.
https://www.php.net/manual/en/migration71.new-features.php#migration71.new-features.asynchronous-signal-handling
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC