Skip to content

Switch zend_type to use MAY_BE_* mask #4727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions .gdbinit
Original file line number Diff line number Diff line change
Expand Up @@ -252,37 +252,34 @@ define ____printzv_contents
____printzv &$zvalue->value.ref->val $arg1
end
if $type == 11
printf "const: %s", $zvalue->value.str->val
printf "CONSTANT_AST"
end
if $type == 12
printf "CONSTANT_AST"
printf "CALLABLE"
end
if $type == 13
printf "indirect: "
____printzv $zvalue->value.zv $arg1
printf "ITERABLE"
end
if $type == 14
printf "pointer: %p", $zvalue->value.ptr
printf "VOID"
end
if $type == 15
printf "_ERROR"
printf "indirect: "
____printzv $zvalue->value.zv $arg1
end
if $type == 16
printf "_BOOL"
printf "pointer: %p", $zvalue->value.ptr
end
if $type == 17
printf "CALLABLE"
printf "_ERROR"
end
if $type == 18
printf "ITERABLE"
printf "_BOOL"
end
if $type == 19
printf "VOID"
end
if $type == 20
printf "_NUMBER"
end
if $type > 20
if $type > 19
printf "unknown type %d", $type
end
printf "\n"
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/type_declarations/typed_properties_054.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ $obj = new A;
var_dump($obj);
?>
--EXPECTF--
Fatal error: Property A::$a cannot have type callable in %s on line %d
Fatal error: Property A::$a cannot have type ?callable in %s on line %d
11 changes: 6 additions & 5 deletions Zend/zend_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "zend_operators.h"
#include "zend_variables.h"
#include "zend_execute.h"
#include "zend_type_info.h"


BEGIN_EXTERN_C()
Expand Down Expand Up @@ -98,11 +99,11 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_ARG_INFO(pass_by_ref, name) { #name, 0, pass_by_ref, 0},
#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, pass_by_ref, 0},
#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, ZEND_TYPE_ENCODE_CLASS_CONST(#classname, allow_null), pass_by_ref, 0 },
#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, ZEND_TYPE_ENCODE(IS_ARRAY, allow_null), pass_by_ref, 0 },
#define ZEND_ARG_CALLABLE_INFO(pass_by_ref, name, allow_null) { #name, ZEND_TYPE_ENCODE(IS_CALLABLE, allow_null), pass_by_ref, 0 },
#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, ZEND_TYPE_ENCODE(type_hint, allow_null), pass_by_ref, 0 },
#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, ZEND_TYPE_ENCODE_CODE(IS_ARRAY, allow_null), pass_by_ref, 0 },
#define ZEND_ARG_CALLABLE_INFO(pass_by_ref, name, allow_null) { #name, ZEND_TYPE_ENCODE_CODE(IS_CALLABLE, allow_null), pass_by_ref, 0 },
#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, ZEND_TYPE_ENCODE_CODE(type_hint, allow_null), pass_by_ref, 0 },
#define ZEND_ARG_VARIADIC_INFO(pass_by_ref, name) { #name, 0, pass_by_ref, 1 },
#define ZEND_ARG_VARIADIC_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, ZEND_TYPE_ENCODE(type_hint, allow_null), pass_by_ref, 1 },
#define ZEND_ARG_VARIADIC_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, ZEND_TYPE_ENCODE_CODE(type_hint, allow_null), pass_by_ref, 1 },
#define ZEND_ARG_VARIADIC_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, ZEND_TYPE_ENCODE_CLASS_CONST(#classname, allow_null), pass_by_ref, 1 },

#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, class_name, allow_null) \
Expand All @@ -114,7 +115,7 @@ typedef struct _zend_fcall_info_cache {

#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
static const zend_internal_arg_info name[] = { \
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_ENCODE(type, allow_null), return_reference, 0 },
{ (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_ENCODE_CODE(type, allow_null), return_reference, 0 },
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(name, type, allow_null) \
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, 0, -1, type, allow_null)

Expand Down
Loading