Skip to content

Commit 4d34156

Browse files
committed
While the compiler does not have the FBC set for zend_get_call_op, optimizer does, and so incorrectly results in ignoring these flags.
If someone has a better patch, please merge it ASAP, this appears to be correct as I and Nikita originally thought. Revert "Revert "zend_get_call_op ignoring compiler flags zend_get_call_op will ignore ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_USER_FUNCTIONS, breaking the intention of these flags"" This reverts commit 0bbbd0f.
1 parent 0bbbd0f commit 4d34156

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

UPGRADING.INTERNALS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ PHP 7.4 INTERNALS UPGRADE NOTES
1717
n. Assignments to references
1818
o. ZEND_COMPILE_EXTENDED_INFO split
1919
p. ZEND_EXT_FCALL_BEGIN can access arguments
20+
q. ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS
2021

2122
2. Build system changes
2223
a. Abstract
@@ -178,6 +179,11 @@ PHP 7.4 INTERNALS UPGRADE NOTES
178179
p. ZEND_EXT_BEGIN_FCALL is emitted after arguments are sent, this means
179180
that handlers may access arguments.
180181

182+
q. ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS
183+
are respected by zend_get_call_op such that when set, the only possible
184+
call opcodes are ZEND_DO_FCALL and ZEND_DO_FCALL_BY_NAME, previously they
185+
were ignored by zend_get_call_op.
186+
181187
========================
182188
2. Build system changes
183189
========================

Zend/zend_compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,15 +3044,15 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */
30443044
ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc) /* {{{ */
30453045
{
30463046
if (fbc) {
3047-
if (fbc->type == ZEND_INTERNAL_FUNCTION) {
3047+
if (fbc->type == ZEND_INTERNAL_FUNCTION && !(CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS)) {
30483048
if (init_op->opcode == ZEND_INIT_FCALL && !zend_execute_internal) {
30493049
if (!(fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED|ZEND_ACC_HAS_TYPE_HINTS|ZEND_ACC_RETURN_REFERENCE))) {
30503050
return ZEND_DO_ICALL;
30513051
} else {
30523052
return ZEND_DO_FCALL_BY_NAME;
30533053
}
30543054
}
3055-
} else {
3055+
} else if (!(CG(compiler_options) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS)){
30563056
if (zend_execute_ex == execute_ex && !(fbc->common.fn_flags & ZEND_ACC_ABSTRACT)) {
30573057
return ZEND_DO_UCALL;
30583058
}

0 commit comments

Comments
 (0)