posix: fix misuse of bool (invalid code in c23)

a bool pointer argument cannot take true or false but either &boolval
or NULL

Closes GH-10577.
This commit is contained in:
Cristian Rodríguez 2023-02-13 16:07:38 +00:00 committed by David Carlier
parent 2abb5850ba
commit ab3f871846

View File

@ -458,7 +458,7 @@ PHP_FUNCTION(posix_ttyname)
RETURN_FALSE;
}
} else {
if (!zend_parse_arg_long(z_fd, &fd, /* is_null */ false, /* check_null */ false, /* arg_num */ 1)) {
if (!zend_parse_arg_long(z_fd, &fd, /* is_null */ NULL, /* check_null */ false, /* arg_num */ 1)) {
php_error_docref(NULL, E_WARNING, "Argument #1 ($file_descriptor) must be of type int|resource, %s given",
zend_zval_value_name(z_fd));
fd = zval_get_long(z_fd);
@ -508,7 +508,7 @@ PHP_FUNCTION(posix_isatty)
RETURN_FALSE;
}
} else {
if (!zend_parse_arg_long(z_fd, &fd, /* is_null */ false, /* check_null */ false, /* arg_num */ 1)) {
if (!zend_parse_arg_long(z_fd, &fd, /* is_null */ NULL, /* check_null */ false, /* arg_num */ 1)) {
php_error_docref(NULL, E_WARNING, "Argument #1 ($file_descriptor) must be of type int|resource, %s given",
zend_zval_value_name(z_fd));
fd = zval_get_long(z_fd);
@ -1242,7 +1242,7 @@ PHP_FUNCTION(posix_fpathconf)
RETURN_FALSE;
}
} else {
if (!zend_parse_arg_long(z_fd, &fd, /* is_null */ false, /* check_null */ false, /* arg_num */ 1)) {
if (!zend_parse_arg_long(z_fd, &fd, /* is_null */ NULL, /* check_null */ false, /* arg_num */ 1)) {
zend_argument_type_error(1, "must be of type int|resource, %s given",
zend_zval_value_name(z_fd));
RETURN_THROWS();