summaryrefslogtreecommitdiff
path: root/Zend/Optimizer/zend_optimizer.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-03-18 15:40:48 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-03-19 10:49:15 +0100
commit2d0e2733c8a0010df9f45693d536531a7a725bdf (patch)
tree715b953768f04d3240c57b14bd8d9c5218af4ada /Zend/Optimizer/zend_optimizer.c
parent6689bedd1796380f882fdecc6dcf8da1ff885c2b (diff)
downloadphp-git-2d0e2733c8a0010df9f45693d536531a7a725bdf.tar.gz
Support prototypes in call graph
Even if we don't know the exact method being called, include it in the call graph with the is_prototype flag. In particular, we can still make use of return types from prototype methods, as PHP 8 makes LSP violations a hard error. Most other places are adjusted to skip calls with !is_prototype. Maybe some of them would be fine, but ignoring them is conservative.
Diffstat (limited to 'Zend/Optimizer/zend_optimizer.c')
-rw-r--r--Zend/Optimizer/zend_optimizer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Zend/Optimizer/zend_optimizer.c b/Zend/Optimizer/zend_optimizer.c
index cc9971a9f8..d6f27b19e6 100644
--- a/Zend/Optimizer/zend_optimizer.c
+++ b/Zend/Optimizer/zend_optimizer.c
@@ -1340,6 +1340,7 @@ static void zend_adjust_fcall_stack_size_graph(zend_op_array *op_array)
zend_op *opline = call_info->caller_init_opline;
if (opline && call_info->callee_func && opline->opcode == ZEND_INIT_FCALL) {
+ ZEND_ASSERT(!call_info->is_prototype);
opline->op1.num = zend_vm_calc_used_stack(opline->extended_value, call_info->callee_func);
}
call_info = call_info->next_callee;