summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-12-20 11:02:57 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-12-20 11:02:57 +0100
commit5155097431f1cf1705376dc85c5788bead61ccba (patch)
tree62f8282aa39facf601f0f81e8c9bea7aa6d82f9d
parent885b3451f4e9616e3d7d8e31cc2270f1b07ab139 (diff)
parentcbb0efaeeb265ff8026dee1d049d57a8d2b5c133 (diff)
downloadphp-git-5155097431f1cf1705376dc85c5788bead61ccba.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #78402: pcntl_signal() misleading error message
-rw-r--r--ext/pcntl/pcntl.c7
-rw-r--r--ext/pcntl/tests/pcntl_signal.phpt2
2 files changed, 6 insertions, 3 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index cd85080c9b..1bb67af6c5 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -1058,6 +1058,7 @@ PHP_FUNCTION(pcntl_signal)
zend_long signo;
zend_bool restart_syscalls = 1;
zend_bool restart_syscalls_is_null = 1;
+ char *error = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz|b!", &signo, &handle, &restart_syscalls, &restart_syscalls_is_null) == FAILURE) {
return;
@@ -1103,13 +1104,15 @@ PHP_FUNCTION(pcntl_signal)
RETURN_TRUE;
}
- if (!zend_is_callable(handle, 0, NULL)) {
+ if (!zend_is_callable_ex(handle, NULL, 0, NULL, NULL, &error)) {
zend_string *func_name = zend_get_callable_name(handle);
PCNTL_G(last_error) = EINVAL;
- php_error_docref(NULL, E_WARNING, "%s is not a callable function name error", ZSTR_VAL(func_name));
+ php_error_docref(NULL, E_WARNING, "Specified handler \"%s\" is not callable (%s)", ZSTR_VAL(func_name), error);
zend_string_release_ex(func_name, 0);
+ efree(error);
RETURN_FALSE;
}
+ ZEND_ASSERT(!error);
/* Add the function name to our signal table */
handle = zend_hash_index_update(&PCNTL_G(php_signal_table), signo, handle);
diff --git a/ext/pcntl/tests/pcntl_signal.phpt b/ext/pcntl/tests/pcntl_signal.phpt
index a6441935c1..953ff54eef 100644
--- a/ext/pcntl/tests/pcntl_signal.phpt
+++ b/ext/pcntl/tests/pcntl_signal.phpt
@@ -42,6 +42,6 @@ bool(false)
Warning: pcntl_signal(): Invalid signal %s
bool(false)
-Warning: pcntl_signal(): not callable is not a callable function name error in %s
+Warning: pcntl_signal(): Specified handler "not callable" is not callable (%s) in %s
bool(false)
ok