From 6c9db6085ae7e2b55e916a34fcf84600ab7eb3a3 Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Wed, 18 Sep 2024 17:45:13 -0700 Subject: [PATCH] ext/standard/exec.c: combine conditions, update docs While `php_escape_shell_cmd()` did indeed `emalloc` a string that needed to be freed by the caller in the original implementation that was put in GitHub (see commit 257de2baded9330ff392f33fd5a7cc0ba271e18d) a few months ago the return type was changed to use `zend_string`, see #14353. Closes GH-16313 --- ext/standard/exec.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 8ebca90bce3..1df46cc050b 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -118,11 +118,7 @@ PHPAPI int php_exec(int type, const char *cmd, zval *array, zval *return_value) php_stream *stream; size_t buflen, bufl = 0; #if PHP_SIGCHILD - void (*sig_handler)() = NULL; -#endif - -#if PHP_SIGCHILD - sig_handler = signal (SIGCHLD, SIG_DFL); + void (*sig_handler)() = signal(SIGCHLD, SIG_DFL); #endif #ifdef PHP_WIN32 @@ -272,8 +268,7 @@ PHP_FUNCTION(passthru) Escape all chars that could possibly be used to break out of a shell command - This function emalloc's a string and returns the pointer. - Remember to efree it when done with it. + This function returns an owned zend_string, remember to release it when done. *NOT* safe for binary strings */