php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75270 SIGTERM causes return code 0 from php cli
Submitted: 2017-09-27 21:27 UTC Modified: 2023-12-08 18:03 UTC
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:0 of 1 (0.0%)
From: behrlich at datto dot com Assigned:
Status: Open Package: CGI/CLI related
PHP Version: 7.0.23 OS: Ubuntu 16.04
Private report: No CVE-ID: None
 [2017-09-27 21:27 UTC] behrlich at datto dot com
Description:
------------
kill -TERM [php pid]

PHP CLI returns 0 rather than the expected 143 (128 + interrupt code). This is NOT the case for other interrupts, for example SIGINT results in return code 130 (128 + 2) as expected. 

I am not able to reproduce this in PHP 5. I can work around this by using the pcntl_signal handlers to correct the response codes, but this involves enabling ticks which is undesirable for my application. 

Test script:
---------------
#!/usr/bin/php -q
<?php

sleep(120);

#(interrupt this process with kill -TERM [pid])

Expected result:
----------------
Program return code 143 for SIGTERM. 

Actual result:
--------------
Program return code 0 for SIGTERM. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2023-12-08 18:03 UTC] bukka@php.net
-Package: Program Execution +Package: CGI/CLI related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC