Req #78700 [Opn]: support posix strsignal(int signo)
| From: | requinix@php.net | Date: | Sun, 20 Oct 2019 10:54:05 +0000 |
| Subject: | Req #78700 [Opn]: support posix strsignal(int signo) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223317@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78700&edit=1
ID: 78700
Updated by: requinix@php.net
Reported by: divinity76+spam at gmail dot com
Summary: support posix strsignal(int signo)
Status: Open
Type: Feature/Change Request
-Package: POSIX related
+Package: PCNTL related
Operating System: POSIX
PHP Version: Next Minor Version
Block user comment: N
Private report: N
New Comment:
It should probably go with the pcntl functions, since it's related to signal handling.
Previous Comments:
------------------------------------------------------------------------
[2019-10-20 09:56:30] divinity76+spam at gmail dot com
Description:
------------
Posix has a function called strsignal(), since at least POSIX.1-2008, docs can be found here https://pubs.opengroup.org/onlinepubs/9699919799/functions/strsignal.html
but the TL;DR is that it converts a signal to it's signal name (like in Linux, signal 15 is
SIGTERM, and it converts int(15) to string("SIGTERM"))
would be nice if the posix extension could add support for it.
a naive-ish userland implementation can be found at https://stackoverflow.com/a/58471626/1067003
(i don't know if the userland implementation is error-free, and it does not use the posix
strsignal() function, but at least it appears to work)
Test script:
---------------
<?php
var_dump(posix_strsignal(SIGTERM));
Expected result:
----------------
string(7) "SIGTERM"
Actual result:
--------------
PHP Fatal error: Uncaught Error: Call to undefined function posix_strsignal() in /foo.php:3
Stack trace:
#0 {main}
thrown in /jail/home/foo.php on line 3
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78700&edit=1