]> granicus.if.org Git - php/commitdiff
Fix UNKNOWN default values in ext/standard
authorMáté Kocsis <kocsismate@woohoolabs.com>
Thu, 20 Aug 2020 22:42:44 +0000 (00:42 +0200)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Mon, 7 Sep 2020 16:58:11 +0000 (18:58 +0200)
Closes GH-6026

25 files changed:
ext/bz2/bz2.stub.php
ext/bz2/bz2_arginfo.h
ext/standard/basic_functions.c
ext/standard/basic_functions.stub.php
ext/standard/basic_functions_arginfo.h
ext/standard/dir.c
ext/standard/dir.stub.php
ext/standard/dir_arginfo.h
ext/standard/file.c
ext/standard/filestat.c
ext/standard/fsock.c
ext/standard/head.c
ext/standard/html.c
ext/standard/info.c
ext/standard/streamsfuncs.c
ext/standard/string.c
ext/standard/tests/directory/DirectoryClass_basic_001.phpt
ext/standard/tests/file/touch.phpt
ext/standard/tests/streams/stream_get_contents_negative_length.phpt
ext/standard/tests/strings/implode1.phpt
ext/standard/tests/strings/join_variation2.phpt
ext/standard/tests/strings/strip_tags_variation2.phpt
ext/standard/versioning.c
ext/zlib/zlib.stub.php
ext/zlib/zlib_arginfo.h

index 2d47c045013bb198e4390931a41f5b6d196f1558..1f8b011059967c5d16ead3f27159ece2bf45410d 100644 (file)
@@ -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
index 322aaf7215cc6a9ae959b14d1d38b6e0af081c2b..902553002edc64d2388c6379a44074bd5ad313b7 100644 (file)
@@ -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)
@@ -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)
index 6ff4c3d573f3420abffec00328f7587196509b59..922bcab330baa50bafcbc3fd1ec1658ff569e688 100755 (executable)
@@ -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();
 
@@ -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;
        }
 
@@ -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);
index 44eb05a015f596df9c18b79eba0d98cd856057ef..9352b9712c148fa5b988cd4bd776f69e995074d0 100755 (executable)
@@ -271,7 +271,7 @@ function ip2long(string $ip_address): int|false {}
 
 function long2ip(int $proper_address): string|false {}
 
-function getenv(string $variable = UNKNOWN, bool $local_only = false): string|array|false {}
+function getenv(?string $variable = null, bool $local_only = false): string|array|false {}
 
 #ifdef HAVE_PUTENV
 function putenv(string $setting): bool {}
@@ -296,7 +296,7 @@ function get_current_user(): string {}
 
 function get_cfg_var(string $option_name): string|array|false {}
 
-function error_log(string $message, int $message_type = 0, string $destination = UNKNOWN, string $extra_headers = UNKNOWN): bool {}
+function error_log(string $message, int $message_type = 0, ?string $destination = null, ?string $extra_headers = null): bool {}
 
 function error_get_last(): ?array {}
 
@@ -343,7 +343,7 @@ function connection_aborted(): int {}
 
 function connection_status(): int {}
 
-function ignore_user_abort(bool $value = UNKNOWN): int {}
+function ignore_user_abort(?bool $value = null): int {}
 
 #if HAVE_GETSERVBYNAME
 function getservbyname(string $service, string $protocol): int|false {}
@@ -504,7 +504,7 @@ function metaphone(string $text, int $phones = 0): string|false {}
 /* {{{ head.c */
 function header(string $string, bool $replace = true, int $http_response_code = 0): void {}
 
-function header_remove(string $name = UNKNOWN): void {}
+function header_remove(?string $name = null): void {}
 
 /** @param array|int $expires_or_options */
 function setrawcookie(string $name, string $value = '', $expires_or_options = 0, string $path = '', string $domain = '', bool $secure = false, bool $httponly = false): bool {}
@@ -528,7 +528,7 @@ function htmlspecialchars(string $string, int $quote_style = ENT_COMPAT, ?string
 
 function htmlspecialchars_decode(string $string, int $quote_style = ENT_COMPAT): string|false {}
 
-function html_entity_decode(string $string, int $quote_style = ENT_COMPAT, string $encoding = UNKNOWN): string|false {}
+function html_entity_decode(string $string, int $quote_style = ENT_COMPAT, ?string $encoding = null): string|false {}
 
 function htmlentities(string $string, int $quote_style = ENT_COMPAT, ?string $encoding = null, bool $double_encode = true): string {}
 
@@ -549,9 +549,9 @@ function bin2hex(string $data): string {}
 
 function hex2bin(string $data): string|false {}
 
-function strspn(string $str, string $mask, int $start = 0, int $len = UNKNOWN): int|false {}
+function strspn(string $str, string $mask, int $start = 0, ?int $len = null): int|false {}
 
-function strcspn(string $str, string $mask, int $start = 0, int $len = UNKNOWN): int|false {}
+function strcspn(string $str, string $mask, int $start = 0, ?int $len = null): int|false {}
 
 #if HAVE_NL_LANGINFO
 function nl_langinfo(int $item): string|false {}
@@ -572,12 +572,12 @@ function wordwrap(string $str, int $width = 75, string $break = "\n", bool $cut
 
 function explode(string $separator, string $str, int $limit = PHP_INT_MAX): array {}
 
-function implode(string|array $glue, array $pieces = UNKNOWN): string {}
+function implode(string|array $glue, ?array $pieces = null): string {}
 
 /** @alias implode */
-function join(string|array $glue, array $pieces = UNKNOWN): string {}
+function join(string|array $glue, ?array $pieces = null): string {}
 
-function strtok(string $str, string $token = UNKNOWN): string|false {}
+function strtok(string $str, ?string $token = null): string|false {}
 
 function strtoupper(string $str): string {}
 
@@ -587,7 +587,7 @@ function basename(string $path, string $suffix = ""): string {}
 
 function dirname(string $path, int $levels = 1): string {}
 
-function pathinfo(string $path, int $options = UNKNOWN): array|string {}
+function pathinfo(string $path, int $options = PATHINFO_ALL): array|string {}
 
 function stristr(string $haystack, string $needle, bool $before_needle = false): string|false {}
 
@@ -617,10 +617,10 @@ function chunk_split(string $str, int $chunklen = 76, string $ending = "\r\n"):
 function substr(string $str, int $start, ?int $length = null): string|false {}
 
 /**
- * @param mixed $start
- * @param mixed $length
+ * @param array|int $start
+ * @param array|int|null $length
  */
-function substr_replace(array|string $str, string|array $replace, $start, $length = UNKNOWN): string|array|false {}
+function substr_replace(array|string $str, string|array $replace, $start, $length = null): string|array|false {}
 
 function quotemeta(string $str): string {}
 
@@ -634,7 +634,7 @@ function lcfirst(string $str): string {}
 
 function ucwords(string $str, string $delimiters = " \t\r\n\f\v"): string {}
 
-function strtr(string $str, string|array $from, string $to = UNKNOWN): string {}
+function strtr(string $str, string|array $from, ?string $to = null): string {}
 
 function strrev(string $str): string {}
 
@@ -650,17 +650,16 @@ function stripcslashes(string $str): string {}
 function stripslashes(string $str): string {}
 
 /** @param int $replace_count */
-function str_replace(array|string $search, array|string $replace, string|array $subject, &$replace_count = UNKNOWN): string|array {}
+function str_replace(array|string $search, array|string $replace, string|array $subject, &$replace_count = null): string|array {}
 
 /** @param int $replace_count */
-function str_ireplace(array|string $search, array|string $replace, string|array $subject, &$replace_count = UNKNOWN): string|array {}
+function str_ireplace(array|string $search, array|string $replace, string|array $subject, &$replace_count = null): string|array {}
 
 function hebrev(string $str, int $max_chars_per_line = 0): string {}
 
 function nl2br(string $str, bool $is_xhtml = true): string {}
 
-/** @param array|string|null $allowable_tags */
-function strip_tags(string $str, $allowable_tags = UNKNOWN): string {}
+function strip_tags(string $str, array|string|null $allowable_tags = null): string {}
 
 /**
  * @param array|string $locales
@@ -693,7 +692,7 @@ function str_rot13(string $str): string {}
 
 function str_shuffle(string $str): string {}
 
-function str_word_count(string $str, int $format = 0, string $charlist = UNKNOWN): array|int {}
+function str_word_count(string $str, int $format = 0, ?string $charlist = null): array|int {}
 
 function str_split(string $str, int $split_length = 1): array {}
 
@@ -706,22 +705,22 @@ function utf8_encode(string $data): string {}
 function utf8_decode(string $data): string {}
 
 /**
- * @param resource $context
+ * @param resource|null $context
  * @return resource|false
  */
-function opendir(string $path, $context = UNKNOWN) {}
+function opendir(string $path, $context = null) {}
 
 /** @param resource $context */
-function getdir(string $path, $context = UNKNOWN): Directory|false {}
+function getdir(string $path, $context = null): Directory|false {}
 
 /**
- * @param resource $context
+ * @param resource|null $context
  * @alias getdir
  */
-function dir(string $path, $context = UNKNOWN): Directory|false {}
+function dir(string $path, $context = null): Directory|false {}
 
-/** @param resource $dir_handle */
-function closedir($dir_handle = UNKNOWN): void {}
+/** @param resource|null $dir_handle */
+function closedir($dir_handle = null): void {}
 
 function chdir(string $directory): bool {}
 
@@ -731,14 +730,14 @@ function chroot(string $directory): bool {}
 
 function getcwd(): string|false {}
 
-/** @param resource $dir_handle */
-function rewinddir($dir_handle = UNKNOWN): void {}
+/** @param resource|null $dir_handle */
+function rewinddir($dir_handle = null): void {}
 
-/** @param resource $dir_handle */
-function readdir($dir_handle = UNKNOWN): string|false {}
+/** @param resource|null $dir_handle */
+function readdir($dir_handle = null): string|false {}
 
-/** @param resource $context */
-function scandir(string $directory, int $sorting_order = 0, $context = UNKNOWN): array|false {}
+/** @param resource|null $context */
+function scandir(string $directory, int $sorting_order = 0, $context = null): array|false {}
 
 #ifdef HAVE_GLOB
 function glob(string $pattern, int $flags = 0): array|false {}
@@ -793,7 +792,7 @@ function rewind($handle): bool {}
 /** @param resource|null $context */
 function rmdir(string $dirname, $context = null): bool {}
 
-function umask(int $mask = UNKNOWN): int {}
+function umask(?int $mask = null): int {}
 
 /** @param resource $handle */
 function fclose($handle): bool {}
@@ -805,7 +804,7 @@ function feof($handle): bool {}
 function fgetc($handle): string|false {}
 
 /** @param resource $handle */
-function fgets($handle, int $length = UNKNOWN): string|false {}
+function fgets($handle, ?int $length = null): string|false {}
 
 /** @param resource $handle */
 function fread($handle, int $length): string|false {}
@@ -838,13 +837,13 @@ function ftell($handle): int|false {}
 function fflush($handle): bool {}
 
 /** @param resource $handle */
-function fwrite($handle, string $content, int $max_length = UNKNOWN): int|false {}
+function fwrite($handle, string $content, ?int $max_length = null): int|false {}
 
 /**
  * @param resource $handle
  * @alias fwrite
  */
-function fputs($handle, string $content, int $max_length = UNKNOWN): int|false {}
+function fputs($handle, string $content, ?int $max_length = null): int|false {}
 
 /** @param resource|null $context */
 function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $context = null): bool {}
@@ -940,7 +939,7 @@ function lchgrp(string $filename, string|int $group): bool {}
 function chmod(string $filename, int $mode): bool {}
 
 #if HAVE_UTIME
-function touch(string $filename, int $time = UNKNOWN, int $atime = UNKNOWN): bool {}
+function touch(string $filename, ?int $time = null, ?int $atime = null): bool {}
 #endif
 
 function clearstatcache(bool $clear_realpath_cache = false, string $filename = ""): void {}
@@ -979,14 +978,14 @@ function vfprintf($handle, string $format, array $args): int {}
  * @param string $errstr
  * @return resource|false
  */
-function fsockopen(string $hostname, int $port = -1, &$errno = null, &$errstr = null, float $timeout = UNKNOWN) {}
+function fsockopen(string $hostname, int $port = -1, &$errno = null, &$errstr = null, ?float $timeout = null) {}
 
 /**
  * @param int $errno
  * @param string $errstr
  * @return resource|false
  */
-function pfsockopen(string $hostname, int $port = -1, &$errno = null, &$errstr = null, float $timeout = UNKNOWN) {}
+function pfsockopen(string $hostname, int $port = -1, &$errno = null, &$errstr = null, ?float $timeout = null) {}
 
 /* http.c */
 
@@ -1008,7 +1007,7 @@ function getimagesizefromstring(string $image, &$image_info = null): array|false
 
 function phpinfo(int $what = INFO_ALL): bool {}
 
-function phpversion(string $extension = UNKNOWN): string|false {}
+function phpversion(?string $extension = null): string|false {}
 
 function phpcredits(int $flag = CREDITS_ALL): bool {}
 
@@ -1044,7 +1043,7 @@ function link(string $target, string $link): bool {}
 
 /* mail.c */
 
-function mail(string $to, string $subject, string $message, string|array $additional_headers = UNKNOWN, string $additional_parameters = ""): bool {}
+function mail(string $to, string $subject, string $message, array|string $additional_headers = [], string $additional_parameters = ""): bool {}
 
 /* math.c */
 
@@ -1233,24 +1232,22 @@ function stream_context_set_option($context, array|string $wrapper_or_options, ?
 function stream_context_get_options($stream_or_context): array {}
 
 /** @return resource */
-function stream_context_get_default(array $options = UNKNOWN) {}
+function stream_context_get_default(?array $options = null) {}
 
 /** @return resource */
 function stream_context_set_default(array $options) {}
 
 /**
  * @param resource $stream
- * @param mixed $params
  * @return resource|false
  */
-function stream_filter_prepend($stream, string $filtername, int $read_write = 0, $params = UNKNOWN) {}
+function stream_filter_prepend($stream, string $filtername, int $read_write = 0, mixed $params = UNKNOWN) {}
 
 /**
  * @param resource $stream
- * @param mixed $params
  * @return resource|false
  */
-function stream_filter_append($stream, string $filtername, int $read_write = 0, $params = UNKNOWN) {}
+function stream_filter_append($stream, string $filtername, int $read_write = 0, mixed $params = UNKNOWN) {}
 
 /** @param resource $stream_filter */
 function stream_filter_remove($stream_filter): bool {}
@@ -1261,7 +1258,7 @@ function stream_filter_remove($stream_filter): bool {}
  * @param resource|null $context
  * @return resource|false
  */
-function stream_socket_client(string $remote_socket, &$errno = null, &$errstr = null, float $timeout = UNKNOWN, int $flags = STREAM_CLIENT_CONNECT, $context = null) {}
+function stream_socket_client(string $remote_socket, &$errno = null, &$errstr = null, ?float $timeout = null, int $flags = STREAM_CLIENT_CONNECT, $context = null) {}
 
 /**
  * @param int $errno
@@ -1277,7 +1274,7 @@ function stream_socket_server(string $local_socket, &$errno = null, &$errstr = n
  * @param string $peername
  * @return resource|false
  */
-function stream_socket_accept($server_socket, float $timeout = UNKNOWN, &$peername = null) {}
+function stream_socket_accept($server_socket, ?float $timeout = null, &$peername = null) {}
 
 /** @param resource $handle */
 function stream_socket_get_name($handle, bool $want_peer): string|false {}
@@ -1310,10 +1307,10 @@ function stream_socket_pair(int $domain, int $type, int $protocol): array|false
  * @param resource $source
  * @param resource $dest
  */
-function stream_copy_to_stream($source, $dest, int $maxlength = UNKNOWN, int $position = 0): int|false {}
+function stream_copy_to_stream($source, $dest, ?int $maxlength = null, int $position = 0): int|false {}
 
 /** @param resource $handle */
-function stream_get_contents($handle, int $maxlength = UNKNOWN, int $position = -1): string|false {}
+function stream_get_contents($handle, ?int $maxlength = null, int $position = -1): string|false {}
 
 /** @param resource $stream */
 function stream_supports_lock($stream): bool {}
@@ -1498,14 +1495,14 @@ function memory_get_peak_usage(bool $real_usage = false): int {}
 
 /* versioning.c */
 
-function version_compare(string $version1, string $version2, string $operator = UNKNOWN): int|bool {}
+function version_compare(string $version1, string $version2, ?string $operator = null): int|bool {}
 
 /* win32/codepage.c */
 
 #ifdef PHP_WIN32
 function sapi_windows_cp_set(int $cp): bool {}
 
-function sapi_windows_cp_get(string $kind = UNKNOWN): int {}
+function sapi_windows_cp_get(string $kind = ""): int {}
 
 function sapi_windows_cp_conv(int|string $in_codepage, int|string $out_codepage, string $subject): ?string {}
 
index ef031e7afb7335f6f2fc9f932553cab043e1d008..61a92dc1852085c6be573d45e80af48d8a870d90 100755 (executable)
@@ -1,5 +1,5 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 28da5d6df91403aad82b5872453053dc41076a6a */
+ * Stub hash: c51ad7a5f254f8d28f2b2c0b46e214c44f0f96cf */
 
 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)
@@ -389,7 +389,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_long2ip, 0, 1, MAY_BE_STRING|MAY
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getenv, 0, 0, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_FALSE)
-       ZEND_ARG_TYPE_INFO(0, variable, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, variable, IS_STRING, 1, "null")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, local_only, _IS_BOOL, 0, "false")
 ZEND_END_ARG_INFO()
 
@@ -439,8 +439,8 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_error_log, 0, 1, _IS_BOOL, 0)
        ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, message_type, IS_LONG, 0, "0")
-       ZEND_ARG_TYPE_INFO(0, destination, IS_STRING, 0)
-       ZEND_ARG_TYPE_INFO(0, extra_headers, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, destination, IS_STRING, 1, "null")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, extra_headers, IS_STRING, 1, "null")
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_error_get_last, 0, 0, IS_ARRAY, 1)
@@ -519,7 +519,7 @@ ZEND_END_ARG_INFO()
 #define arginfo_connection_status arginfo_ob_get_level
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ignore_user_abort, 0, 0, IS_LONG, 0)
-       ZEND_ARG_TYPE_INFO(0, value, _IS_BOOL, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value, _IS_BOOL, 1, "null")
 ZEND_END_ARG_INFO()
 
 #if HAVE_GETSERVBYNAME
@@ -744,7 +744,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header, 0, 1, IS_VOID, 0)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header_remove, 0, 0, IS_VOID, 0)
-       ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, name, IS_STRING, 1, "null")
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_setrawcookie, 0, 1, _IS_BOOL, 0)
@@ -785,7 +785,7 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_html_entity_decode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
        ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, quote_style, IS_LONG, 0, "ENT_COMPAT")
-       ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, encoding, IS_STRING, 1, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_htmlentities arginfo_htmlspecialchars
@@ -818,7 +818,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strspn, 0, 2, MAY_BE_LONG|MAY_BE
        ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO(0, mask, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, start, IS_LONG, 0, "0")
-       ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, len, IS_LONG, 1, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_strcspn arginfo_strspn
@@ -860,14 +860,14 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_implode, 0, 1, IS_STRING, 0)
        ZEND_ARG_TYPE_MASK(0, glue, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
-       ZEND_ARG_TYPE_INFO(0, pieces, IS_ARRAY, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, pieces, IS_ARRAY, 1, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_join arginfo_implode
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtok, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
        ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
-       ZEND_ARG_TYPE_INFO(0, token, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, token, IS_STRING, 1, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_strtoupper arginfo_base64_encode
@@ -886,7 +886,7 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pathinfo, 0, 1, MAY_BE_ARRAY|MAY_BE_STRING)
        ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
-       ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_LONG, 0, "PATHINFO_ALL")
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stristr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
@@ -941,7 +941,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_substr_replace, 0, 3, MAY_BE_STR
        ZEND_ARG_TYPE_MASK(0, str, MAY_BE_ARRAY|MAY_BE_STRING, NULL)
        ZEND_ARG_TYPE_MASK(0, replace, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
        ZEND_ARG_INFO(0, start)
-       ZEND_ARG_INFO(0, length)
+       ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, length, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_quotemeta arginfo_base64_encode
@@ -966,7 +966,7 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strtr, 0, 2, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
        ZEND_ARG_TYPE_MASK(0, from, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
-       ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, to, IS_STRING, 1, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_strrev arginfo_base64_encode
@@ -992,7 +992,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_str_replace, 0, 3, MAY_BE_STRING
        ZEND_ARG_TYPE_MASK(0, search, MAY_BE_ARRAY|MAY_BE_STRING, NULL)
        ZEND_ARG_TYPE_MASK(0, replace, MAY_BE_ARRAY|MAY_BE_STRING, NULL)
        ZEND_ARG_TYPE_MASK(0, subject, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
-       ZEND_ARG_INFO(1, replace_count)
+       ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, replace_count, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_str_ireplace arginfo_str_replace
@@ -1009,7 +1009,7 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strip_tags, 0, 1, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
-       ZEND_ARG_INFO(0, allowable_tags)
+       ZEND_ARG_TYPE_MASK(0, allowable_tags, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null")
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_setlocale, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
@@ -1076,7 +1076,7 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_str_word_count, 0, 1, MAY_BE_ARRAY|MAY_BE_LONG)
        ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, format, IS_LONG, 0, "0")
-       ZEND_ARG_TYPE_INFO(0, charlist, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, charlist, IS_STRING, 1, "null")
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_split, 0, 1, IS_ARRAY, 0)
@@ -1103,18 +1103,18 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_opendir, 0, 0, 1)
        ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
-       ZEND_ARG_INFO(0, context)
+       ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_getdir, 0, 1, Directory, MAY_BE_FALSE)
        ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
-       ZEND_ARG_INFO(0, context)
+       ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_dir arginfo_getdir
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_closedir, 0, 0, IS_VOID, 0)
-       ZEND_ARG_INFO(0, dir_handle)
+       ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, dir_handle, "null")
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chdir, 0, 1, _IS_BOOL, 0)
@@ -1132,13 +1132,13 @@ ZEND_END_ARG_INFO()
 #define arginfo_rewinddir arginfo_closedir
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readdir, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
-       ZEND_ARG_INFO(0, dir_handle)
+       ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, dir_handle, "null")
 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_INFO(0, context)
+       ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
 ZEND_END_ARG_INFO()
 
 #if defined(HAVE_GLOB)
@@ -1218,7 +1218,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rmdir, 0, 1, _IS_BOOL, 0)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_umask, 0, 0, IS_LONG, 0)
-       ZEND_ARG_TYPE_INFO(0, mask, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mask, IS_LONG, 1, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_fclose arginfo_rewind
@@ -1231,7 +1231,7 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fgets, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
        ZEND_ARG_INFO(0, handle)
-       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_MASK_EX(arginfo_fread, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
@@ -1278,7 +1278,7 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
        ZEND_ARG_INFO(0, handle)
        ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
-       ZEND_ARG_TYPE_INFO(0, max_length, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_length, IS_LONG, 1, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_fputs arginfo_fwrite
@@ -1444,8 +1444,8 @@ ZEND_END_ARG_INFO()
 #if HAVE_UTIME
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_touch, 0, 1, _IS_BOOL, 0)
        ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
-       ZEND_ARG_TYPE_INFO(0, time, IS_LONG, 0)
-       ZEND_ARG_TYPE_INFO(0, atime, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, time, IS_LONG, 1, "null")
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, atime, IS_LONG, 1, "null")
 ZEND_END_ARG_INFO()
 #endif
 
@@ -1503,7 +1503,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_fsockopen, 0, 0, 1)
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 0, "-1")
        ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, errno, "null")
        ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, errstr, "null")
-       ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_DOUBLE, 1, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_pfsockopen arginfo_fsockopen
@@ -1539,7 +1539,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpinfo, 0, 0, _IS_BOOL, 0)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phpversion, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
-       ZEND_ARG_TYPE_INFO(0, extension, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, extension, IS_STRING, 1, "null")
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpcredits, 0, 0, _IS_BOOL, 0)
@@ -1601,7 +1601,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mail, 0, 3, _IS_BOOL, 0)
        ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
-       ZEND_ARG_TYPE_MASK(0, additional_headers, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
+       ZEND_ARG_TYPE_MASK(0, additional_headers, MAY_BE_ARRAY|MAY_BE_STRING, "[]")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, additional_parameters, IS_STRING, 0, "\"\"")
 ZEND_END_ARG_INFO()
 
@@ -1887,7 +1887,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_context_get_options, 0, 1
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_get_default, 0, 0, 0)
-       ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null")
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_set_default, 0, 0, 1)
@@ -1898,7 +1898,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_filter_prepend, 0, 0, 2)
        ZEND_ARG_INFO(0, stream)
        ZEND_ARG_TYPE_INFO(0, filtername, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, read_write, IS_LONG, 0, "0")
-       ZEND_ARG_INFO(0, params)
+       ZEND_ARG_TYPE_INFO(0, params, IS_MIXED, 0)
 ZEND_END_ARG_INFO()
 
 #define arginfo_stream_filter_append arginfo_stream_filter_prepend
@@ -1911,7 +1911,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_client, 0, 0, 1)
        ZEND_ARG_TYPE_INFO(0, remote_socket, IS_STRING, 0)
        ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, errno, "null")
        ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, errstr, "null")
-       ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_DOUBLE, 1, "null")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "STREAM_CLIENT_CONNECT")
        ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, context, "null")
 ZEND_END_ARG_INFO()
@@ -1926,7 +1926,7 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_accept, 0, 0, 1)
        ZEND_ARG_INFO(0, server_socket)
-       ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_DOUBLE, 1, "null")
        ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, peername, "null")
 ZEND_END_ARG_INFO()
 
@@ -1974,13 +1974,13 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_copy_to_stream, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
        ZEND_ARG_INFO(0, source)
        ZEND_ARG_INFO(0, dest)
-       ZEND_ARG_TYPE_INFO(0, maxlength, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxlength, IS_LONG, 1, "null")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, position, IS_LONG, 0, "0")
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_get_contents, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
        ZEND_ARG_INFO(0, handle)
-       ZEND_ARG_TYPE_INFO(0, maxlength, IS_LONG, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, maxlength, IS_LONG, 1, "null")
        ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, position, IS_LONG, 0, "-1")
 ZEND_END_ARG_INFO()
 
@@ -2199,7 +2199,7 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_version_compare, 0, 2, MAY_BE_LONG|MAY_BE_BOOL)
        ZEND_ARG_TYPE_INFO(0, version1, IS_STRING, 0)
        ZEND_ARG_TYPE_INFO(0, version2, IS_STRING, 0)
-       ZEND_ARG_TYPE_INFO(0, operator, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, operator, IS_STRING, 1, "null")
 ZEND_END_ARG_INFO()
 
 #if defined(PHP_WIN32)
@@ -2210,7 +2210,7 @@ ZEND_END_ARG_INFO()
 
 #if defined(PHP_WIN32)
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sapi_windows_cp_get, 0, 0, IS_LONG, 0)
-       ZEND_ARG_TYPE_INFO(0, kind, IS_STRING, 0)
+       ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, kind, IS_STRING, 0, "\"\"")
 ZEND_END_ARG_INFO()
 #endif
 
index e480c245fee91d52402545ed918767b5d3d3d139..98bff12fc2bc3b5d336d0c7ba32f9e427f47a422 100644 (file)
@@ -61,9 +61,9 @@ static zend_class_entry *dir_class_entry_ptr;
 #define FETCH_DIRP() \
        ZEND_PARSE_PARAMETERS_START(0, 1) \
                Z_PARAM_OPTIONAL \
-               Z_PARAM_RESOURCE(id) \
+               Z_PARAM_RESOURCE_OR_NULL(id) \
        ZEND_PARSE_PARAMETERS_END(); \
-       if (ZEND_NUM_ARGS() == 0) { \
+       if (!id) { \
                myself = getThis(); \
                if (myself) { \
                        if ((tmp = zend_hash_str_find(Z_OBJPROP_P(myself), "handle", sizeof("handle")-1)) == NULL) { \
@@ -201,7 +201,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
        ZEND_PARSE_PARAMETERS_START(1, 2)
                Z_PARAM_PATH(dirname, dir_len)
                Z_PARAM_OPTIONAL
-               Z_PARAM_RESOURCE(zcontext)
+               Z_PARAM_RESOURCE_OR_NULL(zcontext)
        ZEND_PARSE_PARAMETERS_END();
 
        context = php_stream_context_from_zval(zcontext, 0);
@@ -538,7 +538,7 @@ PHP_FUNCTION(scandir)
                Z_PARAM_PATH(dirn, dirn_len)
                Z_PARAM_OPTIONAL
                Z_PARAM_LONG(flags)
-               Z_PARAM_RESOURCE(zcontext)
+               Z_PARAM_RESOURCE_OR_NULL(zcontext)
        ZEND_PARSE_PARAMETERS_END();
 
        if (dirn_len < 1) {
index 39881f759bf7366e418eea0832e1f4cea138a2fd..86d08c1e1de3ea0a4ad97feb9ffc9212fc63e7df 100755 (executable)
@@ -5,23 +5,23 @@
 class Directory
 {
     /**
-     * @param resource $dir_handle
+     * @param resource|null $dir_handle
      * @return void
      * @alias closedir
      */
-    public function close($dir_handle = UNKNOWN) {}
+    public function close($dir_handle = null) {}
 
     /**
-     * @param resource $dir_handle
+     * @param resource|null $dir_handle
      * @return void
      * @alias rewinddir
      */
-    public function rewind($dir_handle = UNKNOWN) {}
+    public function rewind($dir_handle = null) {}
 
     /**
-     * @param resource $dir_handle
+     * @param resource|null $dir_handle
      * @return string|false
      * @alias readdir
      */
-    public function read($dir_handle = UNKNOWN) {}
+    public function read($dir_handle = null) {}
 }
index 68571fe8be73dc964fe8a365b821ea2175fc55ce..67a22b724931981da7c762f3f14364f297c82298 100644 (file)
@@ -1,8 +1,8 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: ae14c81d7c4642412440f6236b34b7c7c0143911 */
+ * Stub hash: 2670287ef059725cceda0a8f9ac6515cdcedb521 */
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Directory_close, 0, 0, 0)
-       ZEND_ARG_INFO(0, dir_handle)
+       ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, dir_handle, "null")
 ZEND_END_ARG_INFO()
 
 #define arginfo_class_Directory_rewind arginfo_class_Directory_close
index 9883973c5dc335415117804041fbb2eb1d9522f9..6f29343d9f34cc5ef4508a8583c5f8164b89c7e4 100644 (file)
@@ -1015,8 +1015,8 @@ PHPAPI PHP_FUNCTION(fgets)
 {
        zval *res;
        zend_long len = 1024;
+       zend_bool len_is_null = 1;
        char *buf = NULL;
-       int argc = ZEND_NUM_ARGS();
        size_t line_len = 0;
        zend_string *str;
        php_stream *stream;
@@ -1024,12 +1024,12 @@ PHPAPI PHP_FUNCTION(fgets)
        ZEND_PARSE_PARAMETERS_START(1, 2)
                Z_PARAM_RESOURCE(res)
                Z_PARAM_OPTIONAL
-               Z_PARAM_LONG(len)
+               Z_PARAM_LONG_OR_NULL(len, len_is_null)
        ZEND_PARSE_PARAMETERS_END();
 
        PHP_STREAM_TO_ZVAL(stream, res);
 
-       if (argc == 1) {
+       if (len_is_null) {
                /* ask streams to give us a buffer of an appropriate size */
                buf = php_stream_get_line(stream, NULL, 0, &line_len);
                if (buf == NULL) {
@@ -1038,7 +1038,7 @@ PHPAPI PHP_FUNCTION(fgets)
                // TODO: avoid reallocation ???
                RETVAL_STRINGL(buf, line_len);
                efree(buf);
-       } else if (argc > 1) {
+       } else {
                if (len <= 0) {
                        zend_argument_value_error(2, "must be greater than 0");
                        RETURN_THROWS();
@@ -1138,16 +1138,17 @@ PHPAPI PHP_FUNCTION(fwrite)
        ssize_t ret;
        size_t num_bytes;
        zend_long maxlen = 0;
+       zend_bool maxlen_is_null = 1;
        php_stream *stream;
 
        ZEND_PARSE_PARAMETERS_START(2, 3)
                Z_PARAM_RESOURCE(res)
                Z_PARAM_STRING(input, inputlen)
                Z_PARAM_OPTIONAL
-               Z_PARAM_LONG(maxlen)
+               Z_PARAM_LONG_OR_NULL(maxlen, maxlen_is_null)
        ZEND_PARSE_PARAMETERS_END();
 
-       if (ZEND_NUM_ARGS() == 2) {
+       if (maxlen_is_null) {
                num_bytes = inputlen;
        } else if (maxlen <= 0) {
                num_bytes = 0;
@@ -1354,20 +1355,21 @@ PHP_FUNCTION(readfile)
 PHP_FUNCTION(umask)
 {
        zend_long mask = 0;
+       zend_bool mask_is_null = 1;
        int oldumask;
 
+       ZEND_PARSE_PARAMETERS_START(0, 1)
+               Z_PARAM_OPTIONAL
+               Z_PARAM_LONG_OR_NULL(mask, mask_is_null)
+       ZEND_PARSE_PARAMETERS_END();
+
        oldumask = umask(077);
 
        if (BG(umask) == -1) {
                BG(umask) = oldumask;
        }
 
-       ZEND_PARSE_PARAMETERS_START(0, 1)
-               Z_PARAM_OPTIONAL
-               Z_PARAM_LONG(mask)
-       ZEND_PARSE_PARAMETERS_END();
-
-       if (ZEND_NUM_ARGS() == 0) {
+       if (mask_is_null) {
                umask(oldumask);
        } else {
                umask((int) mask);
index cb0b406a322c8847832d84011bca9093b81b529f..3e431c744d63f4b4803c5eed2d41c560687f1747 100644 (file)
@@ -598,7 +598,8 @@ PHP_FUNCTION(touch)
        char *filename;
        size_t filename_len;
        zend_long filetime = 0, fileatime = 0;
-       int ret, argc = ZEND_NUM_ARGS();
+       zend_bool filetime_is_null = 1, fileatime_is_null = 1;
+       int ret;
        FILE *file;
        struct utimbuf newtimebuf;
        struct utimbuf *newtime = &newtimebuf;
@@ -607,28 +608,24 @@ PHP_FUNCTION(touch)
        ZEND_PARSE_PARAMETERS_START(1, 3)
                Z_PARAM_PATH(filename, filename_len)
                Z_PARAM_OPTIONAL
-               Z_PARAM_LONG(filetime)
-               Z_PARAM_LONG(fileatime)
+               Z_PARAM_LONG_OR_NULL(filetime, filetime_is_null)
+               Z_PARAM_LONG_OR_NULL(fileatime, fileatime_is_null)
        ZEND_PARSE_PARAMETERS_END();
 
        if (!filename_len) {
                RETURN_FALSE;
        }
 
-       switch (argc) {
-               case 1:
-                       newtime = NULL;
-                       break;
-               case 2:
-                       newtime->modtime = newtime->actime = filetime;
-                       break;
-               case 3:
-                       newtime->modtime = filetime;
-                       newtime->actime = fileatime;
-                       break;
-               default:
-                       /* Never reached */
-                       WRONG_PARAM_COUNT;
+       if (filetime_is_null && fileatime_is_null) {
+               newtime = NULL;
+       } else if (!filetime_is_null && fileatime_is_null) {
+               newtime->modtime = newtime->actime = filetime;
+       } else if (filetime_is_null && !fileatime_is_null) {
+               zend_argument_value_error(2, "cannot be null when argument #3 ($atime) is an integer");
+               RETURN_THROWS();
+       } else {
+               newtime->modtime = filetime;
+               newtime->actime = fileatime;
        }
 
        wrapper = php_stream_locate_url_wrapper(filename, NULL, 0);
@@ -641,7 +638,7 @@ PHP_FUNCTION(touch)
                        }
                } else {
                        php_stream *stream;
-                       if(argc > 1) {
+                       if(!filetime_is_null || !fileatime_is_null) {
                                php_error_docref(NULL, E_WARNING, "Can not call touch() for a non-standard stream");
                                RETURN_FALSE;
                        }
index 6023234cd34f71609361533eae8fb9b1341bcd8d..a9c3cb0bf5d06f037aed9d6e5d05bc155d6194d5 100644 (file)
@@ -31,7 +31,8 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
        size_t host_len;
        zend_long port = -1;
        zval *zerrno = NULL, *zerrstr = NULL;
-       double timeout = (double)FG(default_socket_timeout);
+       double timeout;
+       zend_bool timeout_is_null = 1;
 #ifndef PHP_WIN32
        time_t conv;
 #else
@@ -45,17 +46,21 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
        size_t hostname_len;
        zend_string *errstr = NULL;
 
-       RETVAL_FALSE;
-
        ZEND_PARSE_PARAMETERS_START(1, 5)
                Z_PARAM_STRING(host, host_len)
                Z_PARAM_OPTIONAL
                Z_PARAM_LONG(port)
                Z_PARAM_ZVAL(zerrno)
                Z_PARAM_ZVAL(zerrstr)
-               Z_PARAM_DOUBLE(timeout)
+               Z_PARAM_DOUBLE_OR_NULL(timeout, timeout_is_null)
        ZEND_PARSE_PARAMETERS_END();
 
+       RETVAL_FALSE;
+
+       if (timeout_is_null) {
+               timeout = (double)FG(default_socket_timeout);
+       }
+
        if (persistent) {
                spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_LONG_FMT, host, port);
        }
index ceca0cbbefcff2cbb38da8597d8ca67fb6b8fad0..cbc7e24a45b3329a402e9c829bfabf765c17bb2d 100644 (file)
@@ -58,12 +58,12 @@ PHP_FUNCTION(header_remove)
 
        ZEND_PARSE_PARAMETERS_START(0, 1)
                Z_PARAM_OPTIONAL
-               Z_PARAM_STRING(line, len)
+               Z_PARAM_STRING_OR_NULL(line, len)
        ZEND_PARSE_PARAMETERS_END();
 
        ctr.line = line;
        ctr.line_len = (uint32_t)len;
-       sapi_header_op(ZEND_NUM_ARGS() == 0 ? SAPI_HEADER_DELETE_ALL : SAPI_HEADER_DELETE, &ctr);
+       sapi_header_op(line == NULL ? SAPI_HEADER_DELETE_ALL : SAPI_HEADER_DELETE, &ctr);
 }
 /* }}} */
 
index 58c2989c855580802fe4c8e1612d709e6e930551..dfed88987538183973cf636c024d633f3aa8a6f8 100644 (file)
@@ -1395,7 +1395,7 @@ PHP_FUNCTION(html_entity_decode)
                Z_PARAM_STR(str)
                Z_PARAM_OPTIONAL
                Z_PARAM_LONG(quote_style)
-               Z_PARAM_STR(hint_charset)
+               Z_PARAM_STR_OR_NULL(hint_charset)
        ZEND_PARSE_PARAMETERS_END();
 
        replaced = php_unescape_html_entities(
index 99ba4a179fcba441c6c65d3fa0286f95b4300930..153cb6cde0140d496abef8502a2622c6cca88f20 100644 (file)
@@ -1263,7 +1263,7 @@ PHP_FUNCTION(phpversion)
 
        ZEND_PARSE_PARAMETERS_START(0, 1)
                Z_PARAM_OPTIONAL
-               Z_PARAM_STRING(ext_name, ext_name_len)
+               Z_PARAM_STRING_OR_NULL(ext_name, ext_name_len)
        ZEND_PARSE_PARAMETERS_END();
 
        if (!ext_name) {
index f56f52930cbfb024d6e8999534cb1ea2f44041a3..78e3896d5be391ab29e59f213d918e4f45ebb502 100644 (file)
@@ -88,7 +88,8 @@ PHP_FUNCTION(stream_socket_client)
 {
        zend_string *host;
        zval *zerrno = NULL, *zerrstr = NULL, *zcontext = NULL;
-       double timeout = (double)FG(default_socket_timeout);
+       double timeout;
+       zend_bool timeout_is_null = 1;
        php_timeout_ull conv;
        struct timeval tv;
        char *hashkey = NULL;
@@ -98,18 +99,22 @@ PHP_FUNCTION(stream_socket_client)
        zend_string *errstr = NULL;
        php_stream_context *context = NULL;
 
-       RETVAL_FALSE;
-
        ZEND_PARSE_PARAMETERS_START(1, 6)
                Z_PARAM_STR(host)
                Z_PARAM_OPTIONAL
                Z_PARAM_ZVAL(zerrno)
                Z_PARAM_ZVAL(zerrstr)
-               Z_PARAM_DOUBLE(timeout)
+               Z_PARAM_DOUBLE_OR_NULL(timeout, timeout_is_null)
                Z_PARAM_LONG(flags)
                Z_PARAM_RESOURCE_OR_NULL(zcontext)
        ZEND_PARSE_PARAMETERS_END();
 
+       RETVAL_FALSE;
+
+       if (timeout_is_null) {
+               timeout = (double)FG(default_socket_timeout);
+       }
+
        context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
 
        if (flags & PHP_STREAM_CLIENT_PERSISTENT) {
@@ -238,7 +243,8 @@ PHP_FUNCTION(stream_socket_server)
 /* {{{ Accept a client connection from a server socket */
 PHP_FUNCTION(stream_socket_accept)
 {
-       double timeout = (double)FG(default_socket_timeout);
+       double timeout;
+       zend_bool timeout_is_null = 1;
        zval *zpeername = NULL;
        zend_string *peername = NULL;
        php_timeout_ull conv;
@@ -250,10 +256,14 @@ PHP_FUNCTION(stream_socket_accept)
        ZEND_PARSE_PARAMETERS_START(1, 3)
                Z_PARAM_RESOURCE(zstream)
                Z_PARAM_OPTIONAL
-               Z_PARAM_DOUBLE(timeout)
+               Z_PARAM_DOUBLE_OR_NULL(timeout, timeout_is_null)
                Z_PARAM_ZVAL(zpeername)
        ZEND_PARSE_PARAMETERS_END();
 
+       if (timeout_is_null) {
+               timeout = (double)FG(default_socket_timeout);
+       }
+
        php_stream_from_zval(stream, zstream);
 
        /* prepare the timeout value for use */
@@ -406,21 +416,23 @@ PHP_FUNCTION(stream_socket_recvfrom)
 /* {{{ Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string. */
 PHP_FUNCTION(stream_get_contents)
 {
-       php_stream      *stream;
-       zval            *zsrc;
-       zend_long               maxlen          = (ssize_t) PHP_STREAM_COPY_ALL,
-                               desiredpos      = -1L;
+       php_stream *stream;
+       zval *zsrc;
+       zend_long maxlen, desiredpos = -1L;
+       zend_bool maxlen_is_null = 1;
        zend_string *contents;
 
        ZEND_PARSE_PARAMETERS_START(1, 3)
                Z_PARAM_RESOURCE(zsrc)
                Z_PARAM_OPTIONAL
-               Z_PARAM_LONG(maxlen)
+               Z_PARAM_LONG_OR_NULL(maxlen, maxlen_is_null)
                Z_PARAM_LONG(desiredpos)
        ZEND_PARSE_PARAMETERS_END();
 
-       if (maxlen < 0 && maxlen != PHP_STREAM_COPY_ALL) {
-               php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to zero, or -1");
+       if (maxlen_is_null) {
+               maxlen = (ssize_t) PHP_STREAM_COPY_ALL;
+       } else if (maxlen < 0 && maxlen != PHP_STREAM_COPY_ALL) {
+               php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to 0, or -1");
                RETURN_FALSE;
        }
 
@@ -463,7 +475,8 @@ PHP_FUNCTION(stream_copy_to_stream)
 {
        php_stream *src, *dest;
        zval *zsrc, *zdest;
-       zend_long maxlen = PHP_STREAM_COPY_ALL, pos = 0;
+       zend_long maxlen, pos = 0;
+       zend_bool maxlen_is_null = 1;
        size_t len;
        int ret;
 
@@ -471,10 +484,14 @@ PHP_FUNCTION(stream_copy_to_stream)
                Z_PARAM_RESOURCE(zsrc)
                Z_PARAM_RESOURCE(zdest)
                Z_PARAM_OPTIONAL
-               Z_PARAM_LONG(maxlen)
+               Z_PARAM_LONG_OR_NULL(maxlen, maxlen_is_null)
                Z_PARAM_LONG(pos)
        ZEND_PARSE_PARAMETERS_END();
 
+       if (maxlen_is_null) {
+               maxlen = PHP_STREAM_COPY_ALL;
+       }
+
        php_stream_from_zval(src, zsrc);
        php_stream_from_zval(dest, zdest);
 
@@ -1074,7 +1091,7 @@ PHP_FUNCTION(stream_context_get_default)
 
        ZEND_PARSE_PARAMETERS_START(0, 1)
                Z_PARAM_OPTIONAL
-               Z_PARAM_ARRAY_HT(params)
+               Z_PARAM_ARRAY_HT_OR_NULL(params)
        ZEND_PARSE_PARAMETERS_END();
 
        if (FG(default_context) == NULL) {
index 5631ce4ac0e454c2c19255a2580440556166b9ed..915b6cff5386b81d4bbed018c76f62f03664e72e 100644 (file)
@@ -68,6 +68,7 @@ void register_string_constants(INIT_FUNC_ARGS)
        REGISTER_LONG_CONSTANT("PATHINFO_BASENAME", PHP_PATHINFO_BASENAME, CONST_CS | CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("PATHINFO_EXTENSION", PHP_PATHINFO_EXTENSION, CONST_CS | CONST_PERSISTENT);
        REGISTER_LONG_CONSTANT("PATHINFO_FILENAME", PHP_PATHINFO_FILENAME, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("PATHINFO_ALL", PHP_PATHINFO_ALL, CONST_CS | CONST_PERSISTENT);
 
        /* If last members of struct lconv equal CHAR_MAX, no grouping is done */
        REGISTER_LONG_CONSTANT("CHAR_MAX", CHAR_MAX, CONST_CS | CONST_PERSISTENT);
@@ -247,16 +248,17 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /
 {
        zend_string *s11, *s22;
        zend_long start = 0, len = 0;
+       zend_bool len_is_null = 1;
 
        ZEND_PARSE_PARAMETERS_START(2, 4)
                Z_PARAM_STR(s11)
                Z_PARAM_STR(s22)
                Z_PARAM_OPTIONAL
                Z_PARAM_LONG(start)
-               Z_PARAM_LONG(len)
+               Z_PARAM_LONG_OR_NULL(len, len_is_null)
        ZEND_PARSE_PARAMETERS_END();
 
-       if (ZEND_NUM_ARGS() < 4) {
+       if (len_is_null) {
                len = ZSTR_LEN(s11);
        }
 
@@ -1228,7 +1230,7 @@ PHP_FUNCTION(implode)
        ZEND_PARSE_PARAMETERS_START(1, 2)
                Z_PARAM_STR_OR_ARRAY_HT(arg1_str, arg1_array)
                Z_PARAM_OPTIONAL
-               Z_PARAM_ARRAY_HT(pieces)
+               Z_PARAM_ARRAY_HT_OR_NULL(pieces)
        ZEND_PARSE_PARAMETERS_END();
 
        if (pieces == NULL) {
@@ -1265,10 +1267,10 @@ PHP_FUNCTION(strtok)
        ZEND_PARSE_PARAMETERS_START(1, 2)
                Z_PARAM_STR(str)
                Z_PARAM_OPTIONAL
-               Z_PARAM_STR(tok)
+               Z_PARAM_STR_OR_NULL(tok)
        ZEND_PARSE_PARAMETERS_END();
 
-       if (ZEND_NUM_ARGS() == 1) {
+       if (!tok) {
                tok = str;
        } else {
                if (BG(strtok_string)) {
@@ -2239,7 +2241,6 @@ PHP_FUNCTION(substr_replace)
        zval *len = NULL;
        zend_long l = 0;
        zend_long f;
-       int argc = ZEND_NUM_ARGS();
        zend_string *result;
        HashPosition from_idx, repl_idx, len_idx;
        zval *tmp_str = NULL, *tmp_repl, *tmp_from = NULL, *tmp_len= NULL;
@@ -2249,7 +2250,7 @@ PHP_FUNCTION(substr_replace)
                Z_PARAM_STR_OR_ARRAY_HT(repl_str, repl_ht)
                Z_PARAM_ZVAL(from)
                Z_PARAM_OPTIONAL
-               Z_PARAM_ZVAL(len)
+               Z_PARAM_ZVAL_OR_NULL(len)
        ZEND_PARSE_PARAMETERS_END();
 
        if (Z_TYPE_P(from) != IS_ARRAY) {
@@ -2259,7 +2260,7 @@ PHP_FUNCTION(substr_replace)
                }
        }
 
-       if (argc > 3) {
+       if (len) {
                if (Z_TYPE_P(len) != IS_ARRAY) {
                        convert_to_long_ex(len);
                        l = Z_LVAL_P(len);
@@ -2272,13 +2273,13 @@ PHP_FUNCTION(substr_replace)
 
        if (str) {
                if (
-                       (argc == 3 && Z_TYPE_P(from) == IS_ARRAY) ||
-                       (argc == 4 && Z_TYPE_P(from) != Z_TYPE_P(len))
+                       (!len && Z_TYPE_P(from) == IS_ARRAY) ||
+                       (len && Z_TYPE_P(from) != Z_TYPE_P(len))
                ) {
                        php_error_docref(NULL, E_WARNING, "'start' and 'length' should be of same type - numerical or array ");
                        RETURN_STR_COPY(str);
                }
-               if (argc == 4 && Z_TYPE_P(from) == IS_ARRAY) {
+               if (len && Z_TYPE_P(from) == IS_ARRAY) {
                        if (zend_hash_num_elements(Z_ARRVAL_P(from)) != zend_hash_num_elements(Z_ARRVAL_P(len))) {
                                php_error_docref(NULL, E_WARNING, "'start' and 'length' should have the same number of elements");
                                RETURN_STR_COPY(str);
@@ -2398,7 +2399,7 @@ PHP_FUNCTION(substr_replace)
                                }
                        }
 
-                       if (argc > 3 && Z_TYPE_P(len) == IS_ARRAY) {
+                       if (len && Z_TYPE_P(len) == IS_ARRAY) {
                                while (len_idx < Z_ARRVAL_P(len)->nNumUsed) {
                                        tmp_len = &Z_ARRVAL_P(len)->arData[len_idx].val;
                                        if (Z_TYPE_P(tmp_len) != IS_UNDEF) {
@@ -2412,7 +2413,7 @@ PHP_FUNCTION(substr_replace)
                                } else {
                                        l = ZSTR_LEN(orig_str);
                                }
-                       } else if (argc > 3) {
+                       } else if (len) {
                                l = Z_LVAL_P(len);
                        } else {
                                l = ZSTR_LEN(orig_str);
@@ -3204,19 +3205,18 @@ PHP_FUNCTION(strtr)
        HashTable *from_ht = NULL;
        char *to = NULL;
        size_t to_len = 0;
-       int ac = ZEND_NUM_ARGS();
 
        ZEND_PARSE_PARAMETERS_START(2, 3)
                Z_PARAM_STR(str)
                Z_PARAM_STR_OR_ARRAY_HT(from_str, from_ht)
                Z_PARAM_OPTIONAL
-               Z_PARAM_STRING(to, to_len)
+               Z_PARAM_STRING_OR_NULL(to, to_len)
        ZEND_PARSE_PARAMETERS_END();
 
-       if (ac == 2 && from_ht == NULL) {
+       if (!to && from_ht == NULL) {
                zend_argument_type_error(2, "must be of type array, string given");
                RETURN_THROWS();
-       } else if (ac != 2 && from_str == NULL) {
+       } else if (to && from_str == NULL) {
                zend_argument_type_error(2, "must be of type string, array given");
                RETURN_THROWS();
        }
@@ -3226,7 +3226,7 @@ PHP_FUNCTION(strtr)
                RETURN_EMPTY_STRING();
        }
 
-       if (ac == 2) {
+       if (!to) {
                if (zend_hash_num_elements(from_ht) < 1) {
                        RETURN_STR_COPY(str);
                } else if (zend_hash_num_elements(from_ht) == 1) {
@@ -4249,7 +4249,6 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
        zend_string *string_key;
        zend_ulong num_key;
        zend_long count = 0;
-       int argc = ZEND_NUM_ARGS();
 
        ZEND_PARSE_PARAMETERS_START(3, 4)
                Z_PARAM_STR_OR_ARRAY_HT(search_str, search_ht)
@@ -4290,7 +4289,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
        } else {        /* if subject is not an array */
                count = php_str_replace_in_subject(search_str, search_ht, replace_str, replace_ht, subject_str, return_value, case_sensitivity);
        }
-       if (argc > 3) {
+       if (zcount) {
                ZEND_TRY_ASSIGN_REF_LONG(zcount, count);
        }
 }
@@ -4562,7 +4561,8 @@ PHP_FUNCTION(strip_tags)
 {
        zend_string *buf;
        zend_string *str;
-       zval *allow=NULL;
+       zend_string *allow_str = NULL;
+       HashTable *allow_ht = NULL;
        const char *allowed_tags=NULL;
        size_t allowed_tags_len=0;
        smart_str tags_ss = {0};
@@ -4570,32 +4570,28 @@ PHP_FUNCTION(strip_tags)
        ZEND_PARSE_PARAMETERS_START(1, 2)
                Z_PARAM_STR(str)
                Z_PARAM_OPTIONAL
-               Z_PARAM_ZVAL(allow)
+               Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(allow_str, allow_ht)
        ZEND_PARSE_PARAMETERS_END();
 
-       if (allow) {
-               if (Z_TYPE_P(allow) == IS_ARRAY) {
-                       zval *tmp;
-                       zend_string *tag;
-
-                       ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(allow), tmp) {
-                               tag = zval_get_string(tmp);
-                               smart_str_appendc(&tags_ss, '<');
-                               smart_str_append(&tags_ss, tag);
-                               smart_str_appendc(&tags_ss, '>');
-                               zend_string_release(tag);
-                       } ZEND_HASH_FOREACH_END();
-                       if (tags_ss.s) {
-                               smart_str_0(&tags_ss);
-                               allowed_tags = ZSTR_VAL(tags_ss.s);
-                               allowed_tags_len = ZSTR_LEN(tags_ss.s);
-                       }
-               } else {
-                       /* To maintain a certain BC, we allow anything for the second parameter and return original string */
-                       convert_to_string(allow);
-                       allowed_tags = Z_STRVAL_P(allow);
-                       allowed_tags_len = Z_STRLEN_P(allow);
+       if (allow_ht) {
+               zval *tmp;
+               zend_string *tag;
+
+               ZEND_HASH_FOREACH_VAL(allow_ht, tmp) {
+                       tag = zval_get_string(tmp);
+                       smart_str_appendc(&tags_ss, '<');
+                       smart_str_append(&tags_ss, tag);
+                       smart_str_appendc(&tags_ss, '>');
+                       zend_string_release(tag);
+               } ZEND_HASH_FOREACH_END();
+               if (tags_ss.s) {
+                       smart_str_0(&tags_ss);
+                       allowed_tags = ZSTR_VAL(tags_ss.s);
+                       allowed_tags_len = ZSTR_LEN(tags_ss.s);
                }
+       } else if (allow_str) {
+               allowed_tags = ZSTR_VAL(allow_str);
+               allowed_tags_len = ZSTR_LEN(allow_str);
        }
 
        buf = zend_string_init(ZSTR_VAL(str), ZSTR_LEN(str), 0);
@@ -5753,7 +5749,7 @@ PHP_FUNCTION(str_word_count)
                Z_PARAM_STR(str)
                Z_PARAM_OPTIONAL
                Z_PARAM_LONG(type)
-               Z_PARAM_STRING(char_list, char_list_len)
+               Z_PARAM_STRING_OR_NULL(char_list, char_list_len)
        ZEND_PARSE_PARAMETERS_END();
 
        switch(type) {
index 355a49452d7e9ad8e49dc5c5a18eae8070c60c4f..7e3c53b7970e27d0cfbcd22fc982f8593870d7a8 100644 (file)
@@ -42,21 +42,21 @@ Class [ <internal%s> class Directory ] {
     Method [ <internal:standard> public method close ] {
 
       - Parameters [1] {
-        Parameter #0 [ <optional> $dir_handle = <default> ]
+        Parameter #0 [ <optional> $dir_handle = null ]
       }
     }
 
     Method [ <internal:standard> public method rewind ] {
 
       - Parameters [1] {
-        Parameter #0 [ <optional> $dir_handle = <default> ]
+        Parameter #0 [ <optional> $dir_handle = null ]
       }
     }
 
     Method [ <internal:standard> public method read ] {
 
       - Parameters [1] {
-        Parameter #0 [ <optional> $dir_handle = <default> ]
+        Parameter #0 [ <optional> $dir_handle = null ]
       }
     }
   }
index 0474b34af214f1cb7a3d0a3b89591b9f452cdc44..32e49f31497ba7844552334b0bc5bf0b8f3fcd73 100644 (file)
@@ -35,6 +35,12 @@ var_dump(touch("/no/such/file/or/directory"));
 
 @unlink($filename);
 
+try {
+    touch("/no/such/file/or/directory", null, 1599492068);
+} catch (ValueError $exception) {
+    echo $exception->getMessage() . "\n";
+}
+
 echo "Done\n";
 ?>
 --EXPECTF--
@@ -51,4 +57,5 @@ int(100)
 
 Warning: touch(): Unable to create file /no/such/file/or/directory because %s in %s on line %d
 bool(false)
+touch(): Argument #2 ($time) cannot be null when argument #3 ($atime) is an integer
 Done
index 3d52729a2f246847e72a624ba7315012badcb020..a0efebc1f193c4dd4820cfd72957b2ad805eb785 100644 (file)
@@ -12,5 +12,5 @@ var_dump(stream_get_contents($tmp, -2));
 --EXPECTF--
 string(2) "bc"
 
-Warning: stream_get_contents(): Length must be greater than or equal to zero, or -1 in %s on line %d
+Warning: stream_get_contents(): Length must be greater than or equal to 0, or -1 in %s on line %d
 bool(false)
index bd0e03c6d565ad01faaf147b996261ead2ea8dd2..fdc9d329a8fad443258bc5c4945d85c74096a47f 100644 (file)
Binary files a/ext/standard/tests/strings/implode1.phpt and b/ext/standard/tests/strings/implode1.phpt differ
index b48c35ca9448abafbfd0a9fecefdafd615237621..5fc83dde794dbae827d4b10e5153cb2be8d0e4b5 100644 (file)
@@ -102,49 +102,49 @@ echo "Done\n";
 
 --- Testing join() by supplying different values for 'pieces' argument ---
 -- Iteration 1 --
-join(): Argument #2 ($pieces) must be of type array, int given
+join(): Argument #2 ($pieces) must be of type ?array, int given
 -- Iteration 2 --
-join(): Argument #2 ($pieces) must be of type array, int given
+join(): Argument #2 ($pieces) must be of type ?array, int given
 -- Iteration 3 --
-join(): Argument #2 ($pieces) must be of type array, int given
+join(): Argument #2 ($pieces) must be of type ?array, int given
 -- Iteration 4 --
-join(): Argument #2 ($pieces) must be of type array, int given
+join(): Argument #2 ($pieces) must be of type ?array, int given
 -- Iteration 5 --
-join(): Argument #2 ($pieces) must be of type array, float given
+join(): Argument #2 ($pieces) must be of type ?array, float given
 -- Iteration 6 --
-join(): Argument #2 ($pieces) must be of type array, float given
+join(): Argument #2 ($pieces) must be of type ?array, float given
 -- Iteration 7 --
-join(): Argument #2 ($pieces) must be of type array, float given
+join(): Argument #2 ($pieces) must be of type ?array, float given
 -- Iteration 8 --
-join(): Argument #2 ($pieces) must be of type array, float given
+join(): Argument #2 ($pieces) must be of type ?array, float given
 -- Iteration 9 --
-join(): Argument #2 ($pieces) must be of type array, float given
+join(): Argument #2 ($pieces) must be of type ?array, float given
 -- Iteration 10 --
-join(): Argument #2 ($pieces) must be of type array, bool given
+join(): Argument #2 ($pieces) must be of type ?array, bool given
 -- Iteration 11 --
-join(): Argument #2 ($pieces) must be of type array, bool given
+join(): Argument #2 ($pieces) must be of type ?array, bool given
 -- Iteration 12 --
-join(): Argument #2 ($pieces) must be of type array, bool given
+join(): Argument #2 ($pieces) must be of type ?array, bool given
 -- Iteration 13 --
-join(): Argument #2 ($pieces) must be of type array, bool given
+join(): Argument #2 ($pieces) must be of type ?array, bool given
 -- Iteration 14 --
-join(): Argument #2 ($pieces) must be of type array, string given
+join(): Argument #2 ($pieces) must be of type ?array, string given
 -- Iteration 15 --
-join(): Argument #2 ($pieces) must be of type array, string given
+join(): Argument #2 ($pieces) must be of type ?array, string given
 -- Iteration 16 --
-join(): Argument #2 ($pieces) must be of type array, test given
+join(): Argument #2 ($pieces) must be of type ?array, test given
 -- Iteration 17 --
-join(): Argument #2 ($pieces) must be of type array, string given
+join(): Argument #2 ($pieces) must be of type ?array, string given
 -- Iteration 18 --
-join(): Argument #2 ($pieces) must be of type array, string given
+join(): Argument #2 ($pieces) must be of type ?array, string given
 -- Iteration 19 --
-join(): Argument #2 ($pieces) must be of type array, null given
+join(): Argument #1 ($pieces) must be of type array, string given
 -- Iteration 20 --
-join(): Argument #2 ($pieces) must be of type array, null given
+join(): Argument #1 ($pieces) must be of type array, string given
 -- Iteration 21 --
-join(): Argument #2 ($pieces) must be of type array, resource given
+join(): Argument #2 ($pieces) must be of type ?array, resource given
 -- Iteration 22 --
-join(): Argument #2 ($pieces) must be of type array, null given
+join(): Argument #1 ($pieces) must be of type array, string given
 -- Iteration 23 --
-join(): Argument #2 ($pieces) must be of type array, null given
+join(): Argument #1 ($pieces) must be of type array, string given
 Done
index 794933e7c0962e3da4b0d199cd42441333e426b2..640e353ab2b81265fe3a5aa47bcd62d98547534b 100644 (file)
@@ -72,7 +72,11 @@ $values = array(
 $iterator = 1;
 foreach($values as $value) {
       echo "-- Iteration $iterator --\n";
-      var_dump( strip_tags($string, $value) );
+      try {
+        var_dump(strip_tags($string, $value));
+      } catch (TypeError $exception) {
+        echo $exception->getMessage() . "\n";
+      }
       $iterator++;
 };
 
@@ -121,5 +125,5 @@ string(10) "helloworld"
 -- Iteration 20 --
 string(10) "helloworld"
 -- Iteration 21 --
-string(10) "helloworld"
+strip_tags(): Argument #2 ($allowable_tags) must be of type array|string|null, resource given
 Done
index d46fd26ccd7d36ec1b7e6332ff43ddcf7af77e06..dbdae6ecf75329beaf1c33e289b1169c13d18459 100644 (file)
@@ -211,7 +211,7 @@ PHP_FUNCTION(version_compare)
                Z_PARAM_STRING(v1, v1_len)
                Z_PARAM_STRING(v2, v2_len)
                Z_PARAM_OPTIONAL
-               Z_PARAM_STRING(op, op_len)
+               Z_PARAM_STRING_OR_NULL(op, op_len)
        ZEND_PARSE_PARAMETERS_END();
 
        compare = php_version_compare(v1, v2);
index 8f4ba12c7964c6b3ed322875d1df2c8a80f0267b..f3c96ca545638d3059427260ee99f4a00033cfb8 100644 (file)
@@ -41,13 +41,13 @@ function gzuncompress(string $data, int $max_decoded_len = 0): string|false {}
  * @param resource $fp
  * @alias fwrite
  */
-function gzwrite($fp, string $str, int $length = UNKNOWN): int|false {}
+function gzwrite($fp, string $str, ?int $length = null): int|false {}
 
 /**
  * @param resource $fp
  * @alias fwrite
  */
-function gzputs($fp, string $str, int $length = UNKNOWN): int|false {}
+function gzputs($fp, string $str, ?int $length = null): int|false {}
 
 /**
  * @param resource $fp
index 134fe9729b47ae2b246a94471cf3d1e1090f1580..86ce095b3bddcaa338cc4c4f9745ca6ef16b3348 100644 (file)
@@ -1,5 +1,5 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: ee70bdd414ad35521ea24384e22ab05e641d81e0 */
+ * Stub hash: b31cdbe9a5d719194753bfe303d32319478048bb */
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ob_gzhandler, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
        ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
@@ -63,7 +63,7 @@ ZEND_END_ARG_INFO()
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gzwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
        ZEND_ARG_INFO(0, fp)
        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()
 
 #define arginfo_gzputs arginfo_gzwrite