Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aa40689

Browse filesBrowse files
bug #60168 [Console] Correctly convert SIGSYS to its name (cs278)
This PR was merged into the 6.4 branch. Discussion ---------- [Console] Correctly convert `SIGSYS` to its name | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | N/A | License | MIT Because of a [PHP easter egg](https://stackoverflow.com/a/48485134) using the `SignalMap::getSignalName()` method with `SIGSYS` results in `'SIGBABY'` instead of the expected `'SIGSYS'` being returned. https://github.com/php/php-src/blob/213949dc340e17b7234c8a753703b1ab455c8585/ext/pcntl/pcntl_arginfo.h#L398-L400 ```php require 'vendor/autoload.php'; var_dump(Symfony\Component\Console\SignalRegistry\SignalMap::getSignalName(SIGSYS)); // string(7) "SIGBABY" ``` Commits ------- 9463951 Correctly convert SIGSYS to its name
2 parents fcec86a + 9463951 commit aa40689
Copy full SHA for aa40689

File tree

2 files changed

+2
-1
lines changed
Filter options

2 files changed

+2
-1
lines changed

‎src/Symfony/Component/Console/SignalRegistry/SignalMap.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/SignalRegistry/SignalMap.php
+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function getSignalName(int $signal): ?string
2727
if (!isset(self::$map)) {
2828
$r = new \ReflectionExtension('pcntl');
2929
$c = $r->getConstants();
30-
$map = array_filter($c, fn ($k) => str_starts_with($k, 'SIG') && !str_starts_with($k, 'SIG_'), \ARRAY_FILTER_USE_KEY);
30+
$map = array_filter($c, fn ($k) => str_starts_with($k, 'SIG') && !str_starts_with($k, 'SIG_') && 'SIGBABY' !== $k, \ARRAY_FILTER_USE_KEY);
3131
self::$map = array_flip($map);
3232
}
3333

‎src/Symfony/Component/Console/Tests/SignalRegistry/SignalMapTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/SignalRegistry/SignalMapTest.php
+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class SignalMapTest extends TestCase
2222
* @testWith [2, "SIGINT"]
2323
* [9, "SIGKILL"]
2424
* [15, "SIGTERM"]
25+
* [31, "SIGSYS"]
2526
*/
2627
public function testSignalExists(int $signal, string $expected)
2728
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.