diff options
| -rw-r--r-- | Zend/zend_compile.c | 5 | ||||
| -rw-r--r-- | Zend/zend_types.h | 7 | ||||
| -rw-r--r-- | ext/com_dotnet/com_handlers.c | 2 | ||||
| -rw-r--r-- | ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt | 122 | ||||
| -rw-r--r-- | ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt | 12 | ||||
| -rw-r--r-- | ext/reflection/php_reflection.c | 3 |
6 files changed, 77 insertions, 74 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1e20ff95b9..9892a9461a 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5453,8 +5453,7 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */ arg_info->name = zend_string_copy(name); arg_info->pass_by_reference = is_ref; arg_info->is_variadic = is_variadic; - /* TODO: Keep compatibility, but may be better reset "allow_null" ??? */ - arg_info->type = ZEND_TYPE_ENCODE_CODE(0, 1); + arg_info->type = ZEND_TYPE_ENCODE_NONE(); if (type_ast) { uint32_t default_type = default_ast ? Z_TYPE(default_node.u.constant) : IS_UNDEF; @@ -5996,7 +5995,7 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t flags) / zend_string *name = zval_make_interned_string(zend_ast_get_zval(name_ast)); zend_string *doc_comment = NULL; zval value_zv; - zend_type type = 0; + zend_type type = ZEND_TYPE_ENCODE_NONE(); if (type_ast) { type = zend_compile_typename(type_ast, 0); diff --git a/Zend/zend_types.h b/Zend/zend_types.h index be6c52b8ca..a7fa6fef5a 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -129,10 +129,10 @@ typedef uintptr_t zend_type; #define _ZEND_TYPE_NULLABLE_BIT Z_L(0x2) #define ZEND_TYPE_IS_SET(t) \ - ((t) > _ZEND_TYPE_FLAG_MASK) + ((t) != 0) #define ZEND_TYPE_IS_MASK(t) \ - (((t) > _ZEND_TYPE_FLAG_MASK) && ((t) <= _ZEND_TYPE_CODE_MAX)) + ((t) <= _ZEND_TYPE_CODE_MAX) #define ZEND_TYPE_IS_CLASS(t) \ ((t) > _ZEND_TYPE_CODE_MAX) @@ -161,6 +161,9 @@ typedef uintptr_t zend_type; #define ZEND_TYPE_WITHOUT_NULL(t) \ ((t) & ~_ZEND_TYPE_NULLABLE_BIT) +#define ZEND_TYPE_ENCODE_NONE() \ + (0) + #define ZEND_TYPE_ENCODE_MASK(maybe_code) \ (maybe_code) diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index fd4cb4ab3b..092e65db57 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -319,7 +319,7 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name f.arg_info = ecalloc(bindptr.lpfuncdesc->cParams, sizeof(zend_arg_info)); for (i = 0; i < bindptr.lpfuncdesc->cParams; i++) { - f.arg_info[i].type = ZEND_TYPE_ENCODE_CODE(0,1); + f.arg_info[i].type = ZEND_TYPE_ENCODE_NONE(); if (bindptr.lpfuncdesc->lprgelemdescParam[i].paramdesc.wParamFlags & PARAMFLAG_FOUT) { f.arg_info[i].pass_by_reference = ZEND_SEND_BY_REF; } diff --git a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt index 47beb1d79b..c341acf2b3 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt @@ -53,42 +53,42 @@ Number of Required Parameters: 0 Inspecting parameter 'host' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'user' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'password' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'database' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'port' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'socket' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -111,42 +111,42 @@ Number of Required Parameters: 0 Inspecting parameter 'host' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'user' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'password' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'database' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'port' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'socket' of method '__construct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -169,7 +169,7 @@ Number of Required Parameters: 1 Inspecting parameter 'mode' of method 'autocommit' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -192,14 +192,14 @@ Number of Required Parameters: 0 Inspecting parameter 'flags' of method 'begin_transaction' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'name' of method 'begin_transaction' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -222,21 +222,21 @@ Number of Required Parameters: 3 Inspecting parameter 'user' of method 'change_user' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no Inspecting parameter 'password' of method 'change_user' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no Inspecting parameter 'database' of method 'change_user' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -291,14 +291,14 @@ Number of Required Parameters: 0 Inspecting parameter 'flags' of method 'commit' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'name' of method 'commit' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -321,42 +321,42 @@ Number of Required Parameters: 0 Inspecting parameter 'host' of method 'connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'user' of method 'connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'password' of method 'connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'database' of method 'connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'port' of method 'connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'socket' of method 'connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -379,7 +379,7 @@ Number of Required Parameters: 1 Inspecting parameter 'debug_options' of method 'debug' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -418,7 +418,7 @@ Number of Required Parameters: 1 Inspecting parameter 'string_to_escape' of method 'escape_string' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -537,7 +537,7 @@ Number of Required Parameters: 1 Inspecting parameter 'connection_id' of method 'kill' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -576,7 +576,7 @@ Number of Required Parameters: 1 Inspecting parameter 'query' of method 'multi_query' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -615,14 +615,14 @@ Number of Required Parameters: 2 Inspecting parameter 'option' of method 'options' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no Inspecting parameter 'value' of method 'options' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -682,14 +682,14 @@ isDefaultValueAvailable: no Inspecting parameter 'sec' of method 'poll' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no Inspecting parameter 'usec' of method 'poll' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -712,7 +712,7 @@ Number of Required Parameters: 1 Inspecting parameter 'query' of method 'prepare' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -735,14 +735,14 @@ Number of Required Parameters: 1 Inspecting parameter 'query' of method 'query' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no Inspecting parameter 'resultmode' of method 'query' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -765,49 +765,49 @@ Number of Required Parameters: 0 Inspecting parameter 'host' of method 'real_connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'user' of method 'real_connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'password' of method 'real_connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'database' of method 'real_connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'port' of method 'real_connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'socket' of method 'real_connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'flags' of method 'real_connect' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -830,7 +830,7 @@ Number of Required Parameters: 1 Inspecting parameter 'string_to_escape' of method 'real_escape_string' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -853,7 +853,7 @@ Number of Required Parameters: 1 Inspecting parameter 'query' of method 'real_query' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -892,7 +892,7 @@ Number of Required Parameters: 1 Inspecting parameter 'options' of method 'refresh' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -915,7 +915,7 @@ Number of Required Parameters: 1 Inspecting parameter 'name' of method 'release_savepoint' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -938,14 +938,14 @@ Number of Required Parameters: 0 Inspecting parameter 'flags' of method 'rollback' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no Inspecting parameter 'name' of method 'rollback' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -968,7 +968,7 @@ Number of Required Parameters: 1 Inspecting parameter 'name' of method 'savepoint' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -991,7 +991,7 @@ Number of Required Parameters: 1 Inspecting parameter 'database' of method 'select_db' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -1014,7 +1014,7 @@ Number of Required Parameters: 1 Inspecting parameter 'charset' of method 'set_charset' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -1037,14 +1037,14 @@ Number of Required Parameters: 2 Inspecting parameter 'option' of method 'set_opt' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no Inspecting parameter 'value' of method 'set_opt' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -1067,35 +1067,35 @@ Number of Required Parameters: 5 Inspecting parameter 'key' of method 'ssl_set' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no Inspecting parameter 'cert' of method 'ssl_set' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no Inspecting parameter 'certificate_authority' of method 'ssl_set' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no Inspecting parameter 'certificate_authority_path' of method 'ssl_set' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no Inspecting parameter 'cipher' of method 'ssl_set' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -1150,7 +1150,7 @@ Number of Required Parameters: 0 Inspecting parameter 'flags' of method 'store_result' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt index b3b7759ace..c130e27a6b 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt @@ -101,7 +101,7 @@ Number of Required Parameters: 1 Inspecting parameter 'offset' of method 'data_seek' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -124,7 +124,7 @@ Number of Required Parameters: 0 Inspecting parameter 'result_type' of method 'fetch_all' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -147,7 +147,7 @@ Number of Required Parameters: 0 Inspecting parameter 'result_type' of method 'fetch_array' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -202,7 +202,7 @@ Number of Required Parameters: 1 Inspecting parameter 'field_nr' of method 'fetch_field_direct' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no @@ -241,7 +241,7 @@ Number of Required Parameters: 0 Inspecting parameter 'class_name' of method 'fetch_object' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: yes isDefaultValueAvailable: no @@ -287,7 +287,7 @@ Number of Required Parameters: 1 Inspecting parameter 'field_nr' of method 'field_seek' isArray: no -allowsNull: no +allowsNull: yes isPassedByReference: no isOptional: no isDefaultValueAvailable: no diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 6273c56def..92723240e9 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2593,7 +2593,8 @@ ZEND_METHOD(reflection_parameter, allowsNull) } GET_REFLECTION_OBJECT_PTR(param); - RETVAL_BOOL(ZEND_TYPE_ALLOW_NULL(param->arg_info->type)); + RETVAL_BOOL(!ZEND_TYPE_IS_SET(param->arg_info->type) + || ZEND_TYPE_ALLOW_NULL(param->arg_info->type)); } /* }}} */ |
