Skip to content
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
16 changes: 16 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,22 @@ void zend_init_compiler_data_structures(void) /* {{{ */
}
/* }}} */

bool zend_arg_uses_strict_types(void) { /* {{{ */
if (!EG(current_execute_data)->prev_execute_data) {
return false;
}

if (!EG(current_execute_data)->prev_execute_data->opline) {
return EG(current_execute_data)->prev_execute_data->prev_execute_data && \
EG(current_execute_data)->prev_execute_data->prev_execute_data->func && \
ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)->prev_execute_data->prev_execute_data);
}

return EG(current_execute_data)->prev_execute_data->func && \
ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)->prev_execute_data);
}
/* }}} */

static void zend_register_seen_symbol(zend_string *name, uint32_t kind) {
zval *zv = zend_hash_find(&FC(seen_symbols), name);
if (zv) {
Expand Down
7 changes: 3 additions & 4 deletions Zend/zend_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,7 @@ ZEND_STATIC_ASSERT(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval),
#define EX_USES_STRICT_TYPES() \
ZEND_CALL_USES_STRICT_TYPES(execute_data)

#define ZEND_ARG_USES_STRICT_TYPES() \
(EG(current_execute_data)->prev_execute_data && \
EG(current_execute_data)->prev_execute_data->func && \
ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)->prev_execute_data))
#define ZEND_ARG_USES_STRICT_TYPES() (zend_arg_uses_strict_types())

#define ZEND_RET_USES_STRICT_TYPES() \
ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))
Expand Down Expand Up @@ -780,6 +777,8 @@ void init_compiler(void);
void shutdown_compiler(void);
void zend_init_compiler_data_structures(void);

bool zend_arg_uses_strict_types(void);

void zend_oparray_context_begin(zend_oparray_context *prev_context);
void zend_oparray_context_end(zend_oparray_context *prev_context);
void zend_file_context_begin(zend_file_context *prev_context);
Expand Down