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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
29 - 24 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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 Apr 16 21:01:28 2024 UTC