]> granicus.if.org Git - php/commitdiff
Make get_defined_vars() always return an array
authorMáté Kocsis <kocsismate@woohoolabs.com>
Fri, 20 Dec 2019 10:10:20 +0000 (11:10 +0100)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Fri, 20 Dec 2019 13:31:57 +0000 (14:31 +0100)
GH-5025

Zend/zend_builtin_functions.c
Zend/zend_builtin_functions.stub.php
Zend/zend_builtin_functions_arginfo.h
ext/opcache/Optimizer/zend_func_info.c

index a369b1eab729ddb628f0359c770426349f13a595..2832fb3e0a7bfd62de1915e90eb016723e7c3d4c 100644 (file)
@@ -1630,7 +1630,7 @@ ZEND_FUNCTION(get_defined_vars)
 
        symbol_table = zend_rebuild_symbol_table();
        if (UNEXPECTED(symbol_table == NULL)) {
-               return;
+               RETURN_EMPTY_ARRAY();
        }
 
        RETURN_ARR(zend_array_dup(symbol_table));
index 57c3f5830c3c0abed24327860bedea75a4a48a5b..47f0869869f3ac7f4ed2146b3a7f0157253cd17b 100644 (file)
@@ -81,7 +81,7 @@ function get_declared_interfaces(): array {}
 
 function get_defined_functions(bool $exclude_disabled = false): array {}
 
-function get_defined_vars(): ?array {}
+function get_defined_vars(): array {}
 
 function get_resource_type($res): string {}
 
index bfe5b82a8a209620df5c584838f558e22b79abc1..3b1df2ab497bdd43f1a3a7552d1c34248bc146fb 100644 (file)
@@ -143,8 +143,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_functions, 0, 0, IS_
        ZEND_ARG_TYPE_INFO(0, exclude_disabled, _IS_BOOL, 0)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_vars, 0, 0, IS_ARRAY, 1)
-ZEND_END_ARG_INFO()
+#define arginfo_get_defined_vars arginfo_get_included_files
 
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_resource_type, 0, 1, IS_STRING, 0)
        ZEND_ARG_INFO(0, res)
index b6a335d843444b79e0888204f4429190feca40c3..988ceeb472642508a6d8424f6137a62fe113b124 100644 (file)
@@ -106,7 +106,7 @@ static const func_info_t func_infos[] = {
        F1("get_declared_classes",    MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
        F1("get_declared_interfaces", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
        F1("get_defined_functions",   MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
-       F1("get_defined_vars",        MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
+       F1("get_defined_vars",        MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
        F1("get_resource_type",       MAY_BE_STRING),
        F1("get_defined_constants",   MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_RESOURCE | MAY_BE_ARRAY_OF_ARRAY),
        F1("debug_backtrace",         MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),