Req #81493 [Opn->Fbk]: shell_exec() should get a `int &$result_code = null` argument
| From: | requinix@php.net | Date: | Fri, 01 Oct 2021 14:37:57 +0000 |
| Subject: | Req #81493 [Opn->Fbk]: shell_exec() should get a `int &$result_code = null` argument | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236968@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81493&edit=1
ID: 81493
Updated by: requinix@php.net
Reported by: divinity76 at gmail dot com
Summary: shell_exec() should get a
int &$result_code = null
argument
-Status: Open
+Status: Feedback
Type: Feature/Change Request
Package: Unknown/Other Function
PHP Version: Next Minor Version
Block user comment: N
Private report: N
New Comment:
If you want a status code then why not use exec() or system()? Do we really need to make all three
functions even *more* similar to each other?
Previous Comments:
------------------------------------------------------------------------
[2021-10-01 13:52:37] divinity76 at gmail dot com
Description:
------------
doing exactly the same as the $result_code argument for system() and passthru() and exec()
Test script:
---------------
<?php
$result_code=null;
shell_exec(bin2hex(random_bytes(10))." 2>&1", $result_code);
var_dump($result_code);
Expected result:
----------------
platform-specific expected result, but at least on Linux one would expect:
int(127)
Actual result:
--------------
PHP Warning: shell_exec() expects exactly 1 parameter, 2 given in /home/hansh/foo3.php on line 3
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81493&edit=1