[php-src] Issue #11904: exec began setting exit_status to -1 starting with 8.1.22
| From: | JaggedJax | Date: | Mon, 07 Aug 2023 18:50:01 +0000 |
| Subject: | [php-src] Issue #11904: exec began setting exit_status to -1 starting with 8.1.22 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245123@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11904
Author: JaggedJax
### Description
The following code:
```php
<?php
$exit_status = 255;
$output = [];
$to_execute = 'ssh scheduler@job.server "php test_script.php"';
exec((string)$to_execute." 2>&1", $output, $exit_status);
```
Resulted in this output:
$exit_status === -1
But I expected this output instead:
$exit_status is between 0 and 255.
This started happening immediately upon upgrading from PHP 8.1.21 to 8.1.22 with no changes to the
existing code. This script is using signal processing as well. I will see if I can create a minimal
script to reliably recreate this issue and update here, but I wanted to get the discussion started
in case anyone else started seeing this happen.
I wonder if this could be related to https://github.com/php/php-src/issues/11498
which went out in 8.1.22
### PHP Version
PHP 8.1.22
### Operating System
Rocky Linux 8.8