printf "CONSTANT_AST"
end
if $type == 12
- printf "CALLABLE"
- end
- if $type == 13
- printf "ITERABLE"
- end
- if $type == 14
- printf "VOID"
- end
- if $type == 15
printf "indirect: "
____printzv $zvalue->value.zv $arg1
end
- if $type == 16
+ if $type == 13
printf "pointer: %p", $zvalue->value.ptr
end
- if $type == 17
+ if $type == 15
printf "_ERROR"
end
- if $type == 18
+ if $type == 16
printf "_BOOL"
end
- if $type == 19
+ if $type == 17
printf "_NUMBER"
end
- if $type > 19
+ if $type > 17
printf "unknown type %d", $type
end
printf "\n"
#define MAY_BE_ANY (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)
#define MAY_BE_REF (1 << IS_REFERENCE) /* may be reference */
-/* These are used in zend_type, but not for type inference. */
+/* These are used in zend_type, but not for type inference.
+ * They are allowed to overlap with types used during inference. */
#define MAY_BE_CALLABLE (1 << IS_CALLABLE)
#define MAY_BE_ITERABLE (1 << IS_ITERABLE)
#define MAY_BE_VOID (1 << IS_VOID)
-#define MAY_BE_ARRAY_SHIFT (IS_VOID)
+#define MAY_BE_ARRAY_SHIFT (IS_REFERENCE)
#define MAY_BE_ARRAY_OF_NULL (MAY_BE_NULL << MAY_BE_ARRAY_SHIFT)
#define MAY_BE_ARRAY_OF_FALSE (MAY_BE_FALSE << MAY_BE_ARRAY_SHIFT)
#define MAY_BE_ARRAY_OF_ANY (MAY_BE_ANY << MAY_BE_ARRAY_SHIFT)
#define MAY_BE_ARRAY_OF_REF (MAY_BE_REF << MAY_BE_ARRAY_SHIFT)
-#define MAY_BE_ARRAY_KEY_LONG (1<<25)
-#define MAY_BE_ARRAY_KEY_STRING (1<<26)
+#define MAY_BE_ARRAY_KEY_LONG (1<<21)
+#define MAY_BE_ARRAY_KEY_STRING (1<<22)
#define MAY_BE_ARRAY_KEY_ANY (MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_KEY_STRING)
-/* Bit 27 unused */
-#define MAY_BE_CLASS (1<<28)
+#define MAY_BE_CLASS (1<<23)
#endif /* ZEND_TYPE_INFO_H */
#define _ZEND_TYPE_EXTRA_FLAGS_SHIFT 24
#define _ZEND_TYPE_MASK ((1u << 24) - 1)
-#define _ZEND_TYPE_MAY_BE_MASK ((1u << (IS_VOID+1)) - 1)
/* Only one of these bits may be set. */
#define _ZEND_TYPE_NAME_BIT (1u << 23)
#define _ZEND_TYPE_CE_BIT (1u << 22)
#define _ZEND_TYPE_KIND_MASK (_ZEND_TYPE_LIST_BIT|_ZEND_TYPE_CE_BIT|_ZEND_TYPE_NAME_BIT)
/* Whether the type list is arena allocated */
#define _ZEND_TYPE_ARENA_BIT (1u << 20)
+/* Type mask excluding the flags above. */
+#define _ZEND_TYPE_MAY_BE_MASK ((1u << 20) - 1)
/* Must have same value as MAY_BE_NULL */
#define _ZEND_TYPE_NULLABLE_BIT 0x2
#define IS_REFERENCE 10
#define IS_CONSTANT_AST 11 /* Constant expressions */
-/* Fake types used only for type hinting. IS_VOID should be the last. */
+/* Fake types used only for type hinting.
+ * These are allowed to overlap with the types below. */
#define IS_CALLABLE 12
#define IS_ITERABLE 13
#define IS_VOID 14
/* internal types */
-#define IS_INDIRECT 15
-#define IS_PTR 16
-#define IS_ALIAS_PTR 17
-#define _IS_ERROR 17
+#define IS_INDIRECT 12
+#define IS_PTR 13
+#define IS_ALIAS_PTR 14
+#define _IS_ERROR 15
/* used for casts */
-#define _IS_BOOL 18
-#define _IS_NUMBER 19
+#define _IS_BOOL 16
+#define _IS_NUMBER 17
static zend_always_inline zend_uchar zval_get_type(const zval* pz) {
return pz->u1.v.type;