Skip to content

Remove unused variable 'error' #12438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions ext/pcntl/pcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,6 @@ PHP_FUNCTION(pcntl_signal)
zend_long signo;
bool restart_syscalls = 1;
bool restart_syscalls_is_null = 1;
char *error = NULL;

ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_LONG(signo)
Expand Down Expand Up @@ -654,14 +653,12 @@ PHP_FUNCTION(pcntl_signal)
RETURN_TRUE;
}

if (!zend_is_callable_ex(handle, NULL, 0, NULL, NULL, &error)) {
if (!zend_is_callable_ex(handle, NULL, 0, NULL, NULL, NULL)) {
PCNTL_G(last_error) = EINVAL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it actually make sense to set the last error here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, EINVAL is for invalid arguments, and the argument is definitely not valid if this check fails.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well sure, but also this used to return false and a warning and not a TypeError, but eh I don't think it's super important.


zend_argument_type_error(2, "must be of type callable|int, %s given", zend_zval_value_name(handle));
efree(error);
RETURN_THROWS();
}
ZEND_ASSERT(!error);

/* Add the function name to our signal table */
handle = zend_hash_index_update(&PCNTL_G(php_signal_table), signo, handle);
Expand Down