Skip to content

Commit 2c96780

Browse files
committed
Fix UNKNOWN default values in ext/standard
Closes GH-6026
1 parent a249980 commit 2c96780

25 files changed

+270
-249
lines changed

ext/bz2/bz2.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function bzread($bz, int $length = 1024): string|false {}
1515
* @param resource $bz
1616
* @alias fwrite
1717
*/
18-
function bzwrite($bz, string $str, int $length = UNKNOWN): int|false {}
18+
function bzwrite($bz, string $str, ?int $length = null): int|false {}
1919

2020
/**
2121
* @param resource $bz

ext/bz2/bz2_arginfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: a5c534b7cd92619dfa0fdf29bd0a94fcda27f089 */
2+
* Stub hash: 9bcd75ddbde225e65ee9f00d86d16677d671b4e4 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_bzopen, 0, 0, 2)
55
ZEND_ARG_INFO(0, file)
@@ -14,7 +14,7 @@ ZEND_END_ARG_INFO()
1414
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
1515
ZEND_ARG_INFO(0, bz)
1616
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
17-
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
17+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
1818
ZEND_END_ARG_INFO()
1919

2020
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzflush, 0, 1, _IS_BOOL, 0)

ext/standard/basic_functions.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ PHP_FUNCTION(getenv)
739739

740740
ZEND_PARSE_PARAMETERS_START(0, 2)
741741
Z_PARAM_OPTIONAL
742-
Z_PARAM_STRING(str, str_len)
742+
Z_PARAM_STRING_OR_NULL(str, str_len)
743743
Z_PARAM_BOOL(local_only)
744744
ZEND_PARSE_PARAMETERS_END();
745745

@@ -1429,22 +1429,17 @@ PHP_FUNCTION(error_log)
14291429
{
14301430
char *message, *opt = NULL, *headers = NULL;
14311431
size_t message_len, opt_len = 0, headers_len = 0;
1432-
int opt_err = 0, argc = ZEND_NUM_ARGS();
14331432
zend_long erropt = 0;
14341433

14351434
ZEND_PARSE_PARAMETERS_START(1, 4)
14361435
Z_PARAM_STRING(message, message_len)
14371436
Z_PARAM_OPTIONAL
14381437
Z_PARAM_LONG(erropt)
1439-
Z_PARAM_PATH(opt, opt_len)
1440-
Z_PARAM_STRING(headers, headers_len)
1438+
Z_PARAM_PATH_OR_NULL(opt, opt_len)
1439+
Z_PARAM_STRING_OR_NULL(headers, headers_len)
14411440
ZEND_PARSE_PARAMETERS_END();
14421441

1443-
if (argc > 1) {
1444-
opt_err = (int)erropt;
1445-
}
1446-
1447-
if (_php_error_log_ex(opt_err, message, message_len, opt, headers) == FAILURE) {
1442+
if (_php_error_log_ex((int) erropt, message, message_len, opt, headers) == FAILURE) {
14481443
RETURN_FALSE;
14491444
}
14501445

@@ -2270,16 +2265,17 @@ PHP_FUNCTION(connection_status)
22702265
PHP_FUNCTION(ignore_user_abort)
22712266
{
22722267
zend_bool arg = 0;
2268+
zend_bool arg_is_null = 1;
22732269
int old_setting;
22742270

22752271
ZEND_PARSE_PARAMETERS_START(0, 1)
22762272
Z_PARAM_OPTIONAL
2277-
Z_PARAM_BOOL(arg)
2273+
Z_PARAM_BOOL_OR_NULL(arg, arg_is_null)
22782274
ZEND_PARSE_PARAMETERS_END();
22792275

22802276
old_setting = (unsigned short)PG(ignore_user_abort);
22812277

2282-
if (ZEND_NUM_ARGS()) {
2278+
if (!arg_is_null) {
22832279
zend_string *key = zend_string_init("ignore_user_abort", sizeof("ignore_user_abort") - 1, 0);
22842280
zend_alter_ini_entry_chars(key, arg ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
22852281
zend_string_release_ex(key, 0);

0 commit comments

Comments
 (0)