com php-src: Remove bool return type from assert_options: ext/opcache/Optimizer/zend_func_info.c ext/standard/ assert.c
ext/standard/basic_functions.stub.php ext/ standard/basic_functions_arginfo.h
| From: | Nikita Popov | Date: | Tue, 21 Jul 2020 08:18:33 +0000 |
| Subject: | com php-src: Remove bool return type from assert_options: ext/opcache/Optimizer/zend_func_info.c ext/standard/ assert.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-112267@lists.php.net to get a copy of this message | ||
Commit: 9d37a574110ff2fdcd50e10e1802825643fb7ff7
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 21 Jul 2020 10:17:21 +0200
Parents: fda78e5965aff018adcd7c65f2215c0a8e48cd17
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9d37a574110ff2fdcd50e10e1802825643fb7ff7
Log:
Remove bool return type from assert_options
Not seeing any way this function can return bool.
Changed paths:
M ext/opcache/Optimizer/zend_func_info.c
M ext/standard/assert.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 c99537dec8..4daf43b27a 100644
--- a/ext/opcache/Optimizer/zend_func_info.c
+++ b/ext/opcache/Optimizer/zend_func_info.c
@@ -412,7 +412,7 @@ static const func_info_t func_infos[] = {
F1("array_chunk", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY |
MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("array_combine", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY |
MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("pos", UNKNOWN_INFO),
- F1("assert_options", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG |
MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING |
MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT),
+ F1("assert_options", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING |
MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT |
MAY_BE_OBJECT),
F1("str_rot13", MAY_BE_STRING),
F1("stream_get_filters", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG |
MAY_BE_ARRAY_OF_STRING),
F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_OBJECT),
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 3aac8d6e48..45648fbc49 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -238,7 +238,7 @@ PHP_FUNCTION(assert_options)
if (ac == 2) {
zend_string *value_str = zval_try_get_string(value);
if (UNEXPECTED(!value_str)) {
- return;
+ RETURN_THROWS();
}
key = zend_string_init("assert.active", sizeof("assert.active")-1, 0);
@@ -254,7 +254,7 @@ PHP_FUNCTION(assert_options)
if (ac == 2) {
zend_string *value_str = zval_try_get_string(value);
if (UNEXPECTED(!value_str)) {
- return;
+ RETURN_THROWS();
}
key = zend_string_init("assert.bail", sizeof("assert.bail")-1, 0);
@@ -270,7 +270,7 @@ PHP_FUNCTION(assert_options)
if (ac == 2) {
zend_string *value_str = zval_try_get_string(value);
if (UNEXPECTED(!value_str)) {
- return;
+ RETURN_THROWS();
}
key = zend_string_init("assert.warning", sizeof("assert.warning")-1, 0);
@@ -300,7 +300,7 @@ PHP_FUNCTION(assert_options)
if (ac == 2) {
zend_string *val = zval_try_get_string(value);
if (UNEXPECTED(!val)) {
- return;
+ RETURN_THROWS();
}
key = zend_string_init("assert.exception", sizeof("assert.exception")-1, 0);
@@ -313,9 +313,7 @@ PHP_FUNCTION(assert_options)
default:
zend_argument_value_error(1, "must have a valid value");
- break;
+ RETURN_THROWS();
}
-
- return;
}
/* }}} */
diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php
index 9a27ae5512..d60dc61577 100755
--- a/ext/standard/basic_functions.stub.php
+++ b/ext/standard/basic_functions.stub.php
@@ -508,7 +508,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|object|int|string|bool|null {}
+function assert_options(int $what, $value = UNKNOWN): array|object|int|string|null {}
/* string.c */
diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h
index 46d323081b..c2060d7890 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: 0a66e5b2c71762a74b9ff9ad11f80d265ef806e3 */
+ * Stub hash: 3f739b2ab0c9317b5e52779e16f4bf56bd19d86e */
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)
@@ -801,7 +801,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_assert, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, description, "null")
ZEND_END_ARG_INFO()
-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_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_NULL)
ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()