]> granicus.if.org Git - php/commitdiff
Make some opcache types consistent with reflection information
authorTyson Andre <tysonandre775@hotmail.com>
Sun, 1 Dec 2019 15:37:39 +0000 (10:37 -0500)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 4 Dec 2019 06:31:06 +0000 (07:31 +0100)
Remove functions such as filter_id() where reference counts and types are
identical to what's in opcache.

Remove null types from zend_func_info.c that aren't in Reflection
(php would throw now)

Fix the Reflection type information for assert_options()

    php > assert_options(ASSERT_CALLBACK, static function() {});
    php > var_export(assert_options(ASSERT_CALLBACK));
    Closure::__set_state(array(
    ))

Closes GH-4958.

ext/opcache/Optimizer/zend_func_info.c
ext/standard/basic_functions.stub.php
ext/standard/basic_functions_arginfo.h

index edebdeb74a99cbe5d88360be29ffe6d42605fec4..855ff42c3df8ba3c250a17f328de22218fbf33b9 100644 (file)
@@ -117,7 +117,7 @@ static const func_info_t func_infos[] = {
 
        /* ext/standard */
        FN("constant",                     MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING | MAY_BE_RESOURCE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
-       F1("bin2hex",                      MAY_BE_FALSE | MAY_BE_STRING),
+       F1("bin2hex",                      MAY_BE_STRING),
        F1("hex2bin",                      MAY_BE_FALSE | MAY_BE_STRING),
        F0("sleep",                        MAY_BE_FALSE | MAY_BE_LONG),
        F0("usleep",                       MAY_BE_NULL | MAY_BE_FALSE),
@@ -167,7 +167,7 @@ static const func_info_t func_infos[] = {
        F1("hebrevc",                      MAY_BE_STRING),
        FN("nl2br",                        MAY_BE_STRING),
        F1("basename",                     MAY_BE_STRING),
-       F1("dirname",                      MAY_BE_NULL | MAY_BE_STRING),
+       F1("dirname",                      MAY_BE_STRING),
        F1("pathinfo",                     MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
        F1("stripslashes",                 MAY_BE_STRING),
        F1("stripcslashes",                MAY_BE_STRING),
@@ -197,7 +197,7 @@ static const func_info_t func_infos[] = {
        FN("str_ireplace",                 MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY | MAY_BE_ARRAY_OF_OBJECT),
        F1("str_repeat",                   MAY_BE_NULL | MAY_BE_STRING),
        F1("count_chars",                  MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
-       F1("chunk_split",                  MAY_BE_FALSE | MAY_BE_STRING),
+       F1("chunk_split",                  MAY_BE_STRING),
        FN("trim",                         MAY_BE_STRING),
        FN("ltrim",                        MAY_BE_STRING),
        F1("strip_tags",                   MAY_BE_STRING),
@@ -303,7 +303,7 @@ static const func_info_t func_infos[] = {
        F1("decbin",                       MAY_BE_STRING),
        F1("decoct",                       MAY_BE_STRING),
        F1("dechex",                       MAY_BE_STRING),
-       F1("base_convert",                 MAY_BE_FALSE | MAY_BE_STRING),
+       F1("base_convert",                 MAY_BE_STRING),
        F1("number_format",                MAY_BE_STRING),
        F0("fmod",                         MAY_BE_DOUBLE),
 #ifdef HAVE_INET_NTOP
@@ -493,7 +493,6 @@ static const func_info_t func_infos[] = {
        F1("get_browser",                  MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_OBJECT | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
        F1("crypt",                        MAY_BE_STRING),
        FN("opendir",                      MAY_BE_FALSE | MAY_BE_RESOURCE),
-       F0("closedir",                     MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
        F0("chdir",                        MAY_BE_FALSE | MAY_BE_TRUE),
 #if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
        F0("chroot",                       MAY_BE_FALSE | MAY_BE_TRUE),
@@ -556,9 +555,9 @@ static const func_info_t func_infos[] = {
        FN("key",                          MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING),
        FN("min",                          UNKNOWN_INFO),
        FN("max",                          UNKNOWN_INFO),
-       FN("array_search",                 MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
+       FN("array_search",                 MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
        F1("compact",                      MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
-       F1("array_fill",                   MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
+       F1("array_fill",                   MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
        F1("array_fill_keys",              MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
        FC("range",                        zend_range_info),
        FN("array_pop",                    UNKNOWN_INFO),
@@ -896,17 +895,17 @@ static const func_info_t func_infos[] = {
        F1("ob_gzhandler",                          MAY_BE_FALSE | MAY_BE_STRING),
 
        /* ext/hash */
-       F1("hash",                                  MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
-       F1("hash_file",                             MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
-       F1("hash_hmac",                             MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+       F1("hash",                                  MAY_BE_FALSE | MAY_BE_STRING),
+       F1("hash_file",                             MAY_BE_FALSE | MAY_BE_STRING),
+       F1("hash_hmac",                             MAY_BE_FALSE | MAY_BE_STRING),
        F1("hash_hmac_algos",                       MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
-       F1("hash_hmac_file",                        MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
-       F1("hash_hkdf",                             MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
-       F1("hash_init",                             MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
-       F1("hash_final",                            MAY_BE_NULL | MAY_BE_STRING),
+       F1("hash_hmac_file",                        MAY_BE_FALSE | MAY_BE_STRING),
+       F1("hash_hkdf",                             MAY_BE_STRING),
+       F1("hash_init",                             MAY_BE_OBJECT),
+       F1("hash_final",                            MAY_BE_STRING),
        F1("hash_copy",                             MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
        F1("hash_algos",                            MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
-       F1("hash_pbkdf2",                           MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+       F1("hash_pbkdf2",                           MAY_BE_STRING),
        F1("mhash_keygen_s2k",                      MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
        F0("mhash_get_block_size",                  MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
        F1("mhash_get_hash_name",                   MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
@@ -1097,17 +1096,16 @@ static const func_info_t func_infos[] = {
        F1("bcadd",                                                                     MAY_BE_STRING),
        F1("bcsub",                                                                     MAY_BE_STRING),
        F1("bcmul",                                                                     MAY_BE_STRING),
-       F1("bcdiv",                                                                     MAY_BE_NULL | MAY_BE_STRING),
-       F1("bcmod",                                                                     MAY_BE_NULL | MAY_BE_STRING),
-       F1("bcpowmod",                                                          MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+       F1("bcdiv",                                                                     MAY_BE_STRING),
+       F1("bcmod",                                                                     MAY_BE_STRING),
+       F1("bcpowmod",                                                          MAY_BE_FALSE | MAY_BE_STRING),
        F1("bcpow",                                                                     MAY_BE_STRING),
-       F1("bcsqrt",                                                            MAY_BE_NULL | MAY_BE_STRING),
+       F1("bcsqrt",                                                            MAY_BE_STRING),
 
        /* ext/exif */
-       F1("exif_tagname",                                                      MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
-       F1("exif_read_data",                                            MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
-       F1("exif_thumbnail",                                            MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
-       F0("exif_imagetype",                                            MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
+       F1("exif_tagname",                                                      MAY_BE_FALSE | MAY_BE_STRING),
+       F1("exif_read_data",                                            MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+       F1("exif_thumbnail",                                            MAY_BE_FALSE | MAY_BE_STRING),
 
        /* ext/filter */
        F0("filter_has_var",                                            MAY_BE_FALSE | MAY_BE_TRUE),
@@ -1116,7 +1114,6 @@ static const func_info_t func_infos[] = {
        F1("filter_input_array",                                        MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
        F1("filter_var_array",                                          MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
        F1("filter_list",                                                       MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
-       F0("filter_id",                                                         MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
 
        /* ext/gettext */
        F1("textdomain",                                                        MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
@@ -1124,7 +1121,7 @@ static const func_info_t func_infos[] = {
        F1("_",                                                                         MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
        F1("dgettext",                                                          MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
        F1("dcgettext",                                                         MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
-       F1("bindtextdomain",                                            MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+       F1("bindtextdomain",                                            MAY_BE_FALSE | MAY_BE_STRING),
 #if HAVE_NGETTEXT
        F1("ngettext",                                                          MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
 #endif
@@ -1132,7 +1129,7 @@ static const func_info_t func_infos[] = {
        F1("dcngettext",                                                        MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
 #endif
 #if HAVE_BIND_TEXTDOMAIN_CODESET
-       F1("bind_textdomain_codeset",                           MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+       F1("bind_textdomain_codeset",                           MAY_BE_FALSE | MAY_BE_STRING),
 #endif
 
        /* ext/fileinfo */
index e4fdec71d4bbc1fa52d78740e34c3e07b0857232..758eab341c08bcc2e4336cddc6f8405fe3d71373 100755 (executable)
@@ -515,7 +515,7 @@ function get_html_translation_table(int $table = HTML_SPECIALCHARS, int $quote_s
 /** @param mixed $assertion */
 function assert($assertion, $description = null): bool {}
 
-function assert_options(int $what, $value = UNKNOWN): array|int|string|bool|null {}
+function assert_options(int $what, $value = UNKNOWN): array|object|int|string|bool|null {}
 
 /* string.c */
 
index 37edc1db21225142a69d01d62b8a79cd8976e6d1..394d6f657c4ab15a711e85f72d1399ab102cfcf6 100755 (executable)
@@ -795,7 +795,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_assert, 0, 1, _IS_BOOL, 0)
        ZEND_ARG_INFO(0, description)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_assert_options, 0, 1, MAY_BE_ARRAY|MAY_BE_LONG|MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_assert_options, 0, 1, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_LONG|MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
        ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0)
        ZEND_ARG_INFO(0, value)
 ZEND_END_ARG_INFO()