Skip to content

Commit be9c5da

Browse files
committed
Remove null from highlight_* return types
Also fix show_source() discrepancy in func_info.
1 parent 69af5ad commit be9c5da

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

ext/opcache/Optimizer/zend_func_info.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ static const func_info_t func_infos[] = {
261261
F1("var_export", MAY_BE_NULL | MAY_BE_STRING),
262262
F1("print_r", MAY_BE_TRUE | MAY_BE_STRING),
263263
F0("register_shutdown_function", MAY_BE_NULL | MAY_BE_FALSE),
264-
F1("highlight_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
265-
F1("show_source", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
266-
F1("highlight_string", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
264+
F1("highlight_file", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
265+
F1("show_source", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
266+
F1("highlight_string", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
267267
F1("php_strip_whitespace", MAY_BE_STRING),
268268
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),
269269
F1("ini_alter", MAY_BE_FALSE | MAY_BE_STRING),

ext/standard/basic_functions.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,7 @@ PHP_FUNCTION(highlight_file)
19221922
if (i) {
19231923
php_output_get_contents(return_value);
19241924
php_output_discard();
1925+
ZEND_ASSERT(Z_TYPE_P(return_value) == IS_STRING);
19251926
} else {
19261927
RETURN_TRUE;
19271928
}
@@ -2004,6 +2005,7 @@ PHP_FUNCTION(highlight_string)
20042005
if (i) {
20052006
php_output_get_contents(return_value);
20062007
php_output_discard();
2008+
ZEND_ASSERT(Z_TYPE_P(return_value) == IS_STRING);
20072009
} else {
20082010
RETURN_TRUE;
20092011
}

ext/standard/basic_functions.stub.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,14 @@ function forward_static_call_array(callable $function, array $args): mixed {}
296296
/** @param callable $function */
297297
function register_shutdown_function($function, mixed ...$args): ?bool {}
298298

299-
function highlight_file(string $filename, bool $return = false): string|bool|null {}
299+
function highlight_file(string $filename, bool $return = false): string|bool {}
300300

301301
/** @alias highlight_file */
302-
function show_source(string $filename, bool $return = false): string|bool|null {}
302+
function show_source(string $filename, bool $return = false): string|bool {}
303303

304304
function php_strip_whitespace(string $filename): string {}
305305

306-
function highlight_string(string $string, bool $return = false): string|bool|null {}
306+
function highlight_string(string $string, bool $return = false): string|bool {}
307307

308308
function ini_get(string $varname): string|false {}
309309

ext/standard/basic_functions_arginfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 3f739b2ab0c9317b5e52779e16f4bf56bd19d86e */
2+
* Stub hash: f19f6cfcda6c591e3842a3c108e078acea21d5be */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
55
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
467467
ZEND_ARG_VARIADIC_TYPE_INFO(0, args, IS_MIXED, 0)
468468
ZEND_END_ARG_INFO()
469469

470-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_file, 0, 1, MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
470+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_file, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
471471
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
472472
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, return, _IS_BOOL, 0, "false")
473473
ZEND_END_ARG_INFO()
@@ -478,7 +478,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_php_strip_whitespace, 0, 1, IS_S
478478
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
479479
ZEND_END_ARG_INFO()
480480

481-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_string, 0, 1, MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
481+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_string, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
482482
ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
483483
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, return, _IS_BOOL, 0, "false")
484484
ZEND_END_ARG_INFO()

0 commit comments

Comments
 (0)