Skip to content

Commit

Permalink
Fix UNKNOWN default values in ext/standard
Browse files Browse the repository at this point in the history
Closes GH-6026
  • Loading branch information
kocsismate committed Sep 7, 2020
1 parent a249980 commit 2c96780
Show file tree
Hide file tree
Showing 25 changed files with 270 additions and 249 deletions.
2 changes: 1 addition & 1 deletion ext/bz2/bz2.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function bzread($bz, int $length = 1024): string|false {}
* @param resource $bz
* @alias fwrite
*/
function bzwrite($bz, string $str, int $length = UNKNOWN): int|false {}
function bzwrite($bz, string $str, ?int $length = null): int|false {}

/**
* @param resource $bz
Expand Down
4 changes: 2 additions & 2 deletions ext/bz2/bz2_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: a5c534b7cd92619dfa0fdf29bd0a94fcda27f089 */
* Stub hash: 9bcd75ddbde225e65ee9f00d86d16677d671b4e4 */

ZEND_BEGIN_ARG_INFO_EX(arginfo_bzopen, 0, 0, 2)
ZEND_ARG_INFO(0, file)
Expand All @@ -14,7 +14,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, bz)
ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzflush, 0, 1, _IS_BOOL, 0)
Expand Down
18 changes: 7 additions & 11 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ PHP_FUNCTION(getenv)

ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(str, str_len)
Z_PARAM_STRING_OR_NULL(str, str_len)
Z_PARAM_BOOL(local_only)
ZEND_PARSE_PARAMETERS_END();

Expand Down Expand Up @@ -1429,22 +1429,17 @@ PHP_FUNCTION(error_log)
{
char *message, *opt = NULL, *headers = NULL;
size_t message_len, opt_len = 0, headers_len = 0;
int opt_err = 0, argc = ZEND_NUM_ARGS();
zend_long erropt = 0;

ZEND_PARSE_PARAMETERS_START(1, 4)
Z_PARAM_STRING(message, message_len)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(erropt)
Z_PARAM_PATH(opt, opt_len)
Z_PARAM_STRING(headers, headers_len)
Z_PARAM_PATH_OR_NULL(opt, opt_len)
Z_PARAM_STRING_OR_NULL(headers, headers_len)
ZEND_PARSE_PARAMETERS_END();

if (argc > 1) {
opt_err = (int)erropt;
}

if (_php_error_log_ex(opt_err, message, message_len, opt, headers) == FAILURE) {
if (_php_error_log_ex((int) erropt, message, message_len, opt, headers) == FAILURE) {
RETURN_FALSE;
}

Expand Down Expand Up @@ -2270,16 +2265,17 @@ PHP_FUNCTION(connection_status)
PHP_FUNCTION(ignore_user_abort)
{
zend_bool arg = 0;
zend_bool arg_is_null = 1;
int old_setting;

ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(arg)
Z_PARAM_BOOL_OR_NULL(arg, arg_is_null)
ZEND_PARSE_PARAMETERS_END();

old_setting = (unsigned short)PG(ignore_user_abort);

if (ZEND_NUM_ARGS()) {
if (!arg_is_null) {
zend_string *key = zend_string_init("ignore_user_abort", sizeof("ignore_user_abort") - 1, 0);
zend_alter_ini_entry_chars(key, arg ? "1" : "0", 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
zend_string_release_ex(key, 0);
Expand Down

0 comments on commit 2c96780

Please sign in to comment.