com php-src: Remove possible false return value from get_object_vars(): Zend/zend_builtin_functions .c ext/opcache/Optimizer/zend_func_info.c
| From: | Nikita Popov | Date: | Thu, 06 Jun 2019 07:49:25 +0000 |
| Subject: | com php-src: Remove possible false return value from get_object_vars(): Zend/zend_builtin_functions .c ext/opcache/Optimizer/zend_func_info.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106582@lists.php.net to get a copy of this message | ||
Commit: 252216b2ded7d3808e2a909bfea1e805ee17cde5
Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 6 Jun 2019 09:49:25 +0200
Parents: a8ac6e6604ef0ce9ffbaeb6a775411530f3f4d72
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=252216b2ded7d3808e2a909bfea1e805ee17cde5
Log:
Remove possible false return value from get_object_vars()
I'm not sure this one ever happens in practice (and we might want
to forbid NULL return from get_properties), but if it does, return
an empty array instead of false.
Changed paths:
M Zend/zend_builtin_functions.c
M ext/opcache/Optimizer/zend_func_info.c
Diff:
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 13c6e63..4dca318 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -135,7 +135,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class_vars, 0, 0, 1)
ZEND_ARG_INFO(0, class_name)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_object_vars, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_object_vars, 0, 1, IS_ARRAY, 0)
ZEND_ARG_INFO(0, obj)
ZEND_END_ARG_INFO()
@@ -1099,7 +1099,7 @@ ZEND_FUNCTION(get_object_vars)
zobj = Z_OBJ_P(obj);
properties = zobj->handlers->get_properties(zobj);
if (properties == NULL) {
- RETURN_FALSE;
+ RETURN_EMPTY_ARRAY();
}
if (!zobj->ce->default_properties_count && properties == zobj->properties
&& !GC_IS_RECURSIVE(properties)) {
diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c
index 5d2ec26..7fa542a 100644
--- a/ext/opcache/Optimizer/zend_func_info.c
+++ b/ext/opcache/Optimizer/zend_func_info.c
@@ -110,7 +110,7 @@ static const func_info_t func_infos[] = {
F0("is_subclass_of", MAY_BE_FALSE | MAY_BE_TRUE), // TODO: inline
F0("is_a", MAY_BE_FALSE | MAY_BE_TRUE), // TODO: inline
F1("get_class_vars", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING |
MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
- FN("get_object_vars", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY |
MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
+ FN("get_object_vars", MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY |
MAY_BE_ARRAY_OF_REF),
F1("get_class_methods", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY |
MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F0("method_exists", MAY_BE_FALSE | MAY_BE_TRUE),
F0("property_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),