com php-src: Remove null from highlight_* return types: ext/opcache/Optimizer/zend_func_info.c ext/standard/ basic_functions.c
ext/standard/basic_functions.stub .php ext/standard/basic_functions_arginfo.h
| From: | Nikita Popov | Date: | Tue, 21 Jul 2020 08:40:08 +0000 |
| Subject: | com php-src: Remove null from highlight_* return types: ext/opcache/Optimizer/zend_func_info.c ext/standard/ basic_functions.c ext/standard/basic_functions.stub .php ext/standard/basic_functions_arginfo.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112271@lists.php.net to get a copy of this message | ||
Commit: be9c5daf286b856e943bccbe3fa45161afe5a222
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 21 Jul 2020 10:25:22 +0200
Parents: 69af5adc55bcd06952d5b58574e2a454b5149d01
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be9c5daf286b856e943bccbe3fa45161afe5a222
Log:
Remove null from highlight_* return types
Also fix show_source() discrepancy in func_info.
Changed paths:
M ext/opcache/Optimizer/zend_func_info.c
M ext/standard/basic_functions.c
M ext/standard/basic_functions.stub.php
M ext/standard/basic_functions_arginfo.h
Diff:
diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c
index 4daf43b27a..28fb9cbe6a 100644
--- a/ext/opcache/Optimizer/zend_func_info.c
+++ b/ext/opcache/Optimizer/zend_func_info.c
@@ -261,9 +261,9 @@ static const func_info_t func_infos[] = {
F1("var_export", MAY_BE_NULL | MAY_BE_STRING),
F1("print_r", MAY_BE_TRUE | MAY_BE_STRING),
F0("register_shutdown_function", MAY_BE_NULL | MAY_BE_FALSE),
- F1("highlight_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE |
MAY_BE_STRING),
- F1("show_source", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("highlight_string", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE |
MAY_BE_STRING),
+ F1("highlight_file", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
+ F1("show_source", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
+ F1("highlight_string", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("php_strip_whitespace", MAY_BE_STRING),
F1("ini_get_all", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING
| MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("ini_alter", MAY_BE_FALSE | MAY_BE_STRING),
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 6ca3cc7d6d..6f2ce46c88 100755
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -1922,6 +1922,7 @@ PHP_FUNCTION(highlight_file)
if (i) {
php_output_get_contents(return_value);
php_output_discard();
+ ZEND_ASSERT(Z_TYPE_P(return_value) == IS_STRING);
} else {
RETURN_TRUE;
}
@@ -2004,6 +2005,7 @@ PHP_FUNCTION(highlight_string)
if (i) {
php_output_get_contents(return_value);
php_output_discard();
+ ZEND_ASSERT(Z_TYPE_P(return_value) == IS_STRING);
} else {
RETURN_TRUE;
}
diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php
index d60dc61577..1d6a3cd49a 100755
--- a/ext/standard/basic_functions.stub.php
+++ b/ext/standard/basic_functions.stub.php
@@ -296,14 +296,14 @@ function forward_static_call_array(callable $function, array $args): mixed {}
/** @param callable $function */
function register_shutdown_function($function, mixed ...$args): ?bool {}
-function highlight_file(string $filename, bool $return = false): string|bool|null {}
+function highlight_file(string $filename, bool $return = false): string|bool {}
/** @alias highlight_file */
-function show_source(string $filename, bool $return = false): string|bool|null {}
+function show_source(string $filename, bool $return = false): string|bool {}
function php_strip_whitespace(string $filename): string {}
-function highlight_string(string $string, bool $return = false): string|bool|null {}
+function highlight_string(string $string, bool $return = false): string|bool {}
function ini_get(string $varname): string|false {}
diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h
index c2060d7890..7784f49111 100755
--- a/ext/standard/basic_functions_arginfo.h
+++ b/ext/standard/basic_functions_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 3f739b2ab0c9317b5e52779e16f4bf56bd19d86e */
+ * Stub hash: f19f6cfcda6c591e3842a3c108e078acea21d5be */
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)
@@ -467,7 +467,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_register_shutdown_function, 0, 1
ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_file, 0, 1,
MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_file, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, return, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()
@@ -478,7 +478,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_php_strip_whitespace, 0, 1, IS_S
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_string, 0, 1,
MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_string, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, return, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()