]> granicus.if.org Git - php/commitdiff
Parameter type and name fixes in ext/standard
authorMáté Kocsis <kocsismate@woohoolabs.com>
Sat, 24 Oct 2020 12:15:07 +0000 (14:15 +0200)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Tue, 27 Oct 2020 10:27:25 +0000 (11:27 +0100)
Closes GH-6382

ext/standard/basic_functions.stub.php
ext/standard/basic_functions_arginfo.h
ext/standard/dir.c
ext/standard/url.c

index 98ea45be6becb1f8a4d3bacf87fcafaf524e2cf6..b7c50ef10ad035c83fb42560d45dcf07bb409de5 100755 (executable)
@@ -285,7 +285,7 @@ function time_sleep_until(float $timestamp): bool {}
 
 function get_current_user(): string {}
 
-function get_cfg_var(string $name): string|array|false {}
+function get_cfg_var(string $option): string|array|false {}
 
 function error_log(string $message, int $message_type = 0, ?string $destination = null, ?string $additional_headers = null): bool {}
 
@@ -312,16 +312,16 @@ function php_strip_whitespace(string $filename): string {}
 
 function highlight_string(string $string, bool $return = false): string|bool {}
 
-function ini_get(string $name): string|false {}
+function ini_get(string $option): string|false {}
 
 function ini_get_all(?string $extension = null, bool $details = true): array|false {}
 
-function ini_set(string $name, string $value): string|false {}
+function ini_set(string $option, string $value): string|false {}
 
 /** @alias ini_set */
-function ini_alter(string $name, string $value): string|false {}
+function ini_alter(string $option, string $value): string|false {}
 
-function ini_restore(string $name): void {}
+function ini_restore(string $option): void {}
 
 function set_include_path(string $include_path): string|false {}
 
@@ -722,7 +722,7 @@ function rewinddir($dir_handle = null): void {}
 function readdir($dir_handle = null): string|false {}
 
 /** @param resource|null $context */
-function scandir(string $directory, int $sorting_order = 0, $context = null): array|false {}
+function scandir(string $directory, int $sorting_order = SCANDIR_SORT_ASCENDING, $context = null): array|false {}
 
 #ifdef HAVE_GLOB
 function glob(string $pattern, int $flags = 0): array|false {}
@@ -1110,7 +1110,7 @@ function dechex(int $num): string {}
 
 function base_convert(string $num, int $from_base, int $to_base): string {}
 
-function number_format(float $num, int $decimals = 0, ?string $decimal_separator = "." , ?string $thousands_separator = ","): string {}
+function number_format(float $num, int $decimals = 0, ?string $decimal_separator = ".", ?string $thousands_separator = ","): string {}
 
 function fmod(float $num1, float $num2): float {}
 
@@ -1125,7 +1125,7 @@ function gettimeofday(bool $as_float = false): array|float {}
 #endif
 
 #ifdef HAVE_GETRUSAGE
-function getrusage(bool $mode = 0): array|false {}
+function getrusage(int $mode = 0): array|false {}
 #endif
 
 /* pack.c */
@@ -1277,7 +1277,7 @@ function stream_socket_sendto($socket, string $data, int $flags = 0, string $add
  * @param resource $stream
  * @param resource|null $session_stream
  */
-function stream_socket_enable_crypto($stream, bool $enable, ?int $crypto_type = null, $session_stream = null): int|bool {}
+function stream_socket_enable_crypto($stream, bool $enable, ?int $crypto_method = null, $session_stream = null): int|bool {}
 
 #ifdef HAVE_SHUTDOWN
 /** @param resource $stream */
@@ -1439,8 +1439,7 @@ function rawurlencode(string $string): string {}
 function rawurldecode(string $string): string {}
 
 /** @param resource $context */
-// TODO: Make bool argument?
-function get_headers(string $url, int $as_assoc_array = 0, $context = null): array|false {}
+function get_headers(string $url, bool $associative = false, $context = null): array|false {}
 
 /* user_filters.c */
 
index 4cc243b3425d266abce21c0df8be1cb4a118e31d..0fcc6caedf2471afcdc32e38c737e65a8a2210b5 100644 (file)
@@ -1,5 +1,5 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 146996b3110f85a6a2d074fb910f0d7aae573358 */
+ * Stub hash: e38af54610d415ef27b19137645d8f6481953624 */
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
        ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
@@ -426,7 +426,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_current_user, 0, 0, IS_STRIN
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_cfg_var, 0, 1, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_FALSE)
-       ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_error_log, 0, 1, _IS_BOOL, 0)
@@ -477,7 +477,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_string, 0, 1, MAY_BE_S
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ini_get, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
-       ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ini_get_all, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
@@ -486,14 +486,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ini_get_all, 0, 0, MAY_BE_ARRAY|
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ini_set, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
-       ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
 ZEND_END_ARG_INFO()
 
 #define arginfo_ini_alter arginfo_ini_set
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ini_restore, 0, 1, IS_VOID, 0)
-       ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_set_include_path, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
@@ -1125,7 +1125,7 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_scandir, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
        ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, sorting_order, IS_LONG, 0, "0")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, sorting_order, IS_LONG, 0, "SCANDIR_SORT_ASCENDING")
        ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
 ZEND_END_ARG_INFO()
 
@@ -1734,7 +1734,7 @@ ZEND_END_ARG_INFO()
 
 #if defined(HAVE_GETRUSAGE)
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getrusage, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, _IS_BOOL, 0, "0")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "0")
 ZEND_END_ARG_INFO()
 #endif
 
@@ -1931,7 +1931,7 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_socket_enable_crypto, 0, 2, MAY_BE_LONG|MAY_BE_BOOL)
        ZEND_ARG_INFO(0, stream)
        ZEND_ARG_TYPE_INFO(0, enable, _IS_BOOL, 0)
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, crypto_type, IS_LONG, 1, "null")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, crypto_method, IS_LONG, 1, "null")
        ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, session_stream, "null")
 ZEND_END_ARG_INFO()
 
@@ -2110,7 +2110,7 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_headers, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
        ZEND_ARG_TYPE_INFO(0, url, IS_STRING, 0)
-       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, as_assoc_array, IS_LONG, 0, "0")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, associative, _IS_BOOL, 0, "false")
        ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
 ZEND_END_ARG_INFO()
 
index c1c264d1f0a8b166ed9da4bf2b5a46198cc54c5b..6807c534bacf0301c1ae48eb9734eeb354de241b 100644 (file)
@@ -530,7 +530,7 @@ PHP_FUNCTION(scandir)
 {
        char *dirn;
        size_t dirn_len;
-       zend_long flags = 0;
+       zend_long flags = PHP_SCANDIR_SORT_ASCENDING;
        zend_string **namelist;
        int n, i;
        zval *zcontext = NULL;
index b24fe8ecf8d0c49664403a5cc2890210683273a5..74d510951fc285673d16c73ed4732e4e24315424 100644 (file)
@@ -671,14 +671,14 @@ PHP_FUNCTION(get_headers)
        size_t url_len;
        php_stream *stream;
        zval *prev_val, *hdr = NULL;
-       zend_long format = 0;
+       zend_bool format = 0;
        zval *zcontext = NULL;
        php_stream_context *context;
 
        ZEND_PARSE_PARAMETERS_START(1, 3)
                Z_PARAM_PATH(url, url_len)
                Z_PARAM_OPTIONAL
-               Z_PARAM_LONG(format)
+               Z_PARAM_BOOL(format)
                Z_PARAM_RESOURCE_OR_NULL(zcontext)
        ZEND_PARSE_PARAMETERS_END();