Skip to content

Commit e6d02e3

Browse files
committed
Do not compact runtime cache for calls made in a namespace
1 parent 6debe4e commit e6d02e3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Zend/Optimizer/compact_literals.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,6 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
600600
break;
601601
case ZEND_INIT_FCALL:
602602
case ZEND_INIT_FCALL_BY_NAME:
603-
case ZEND_INIT_NS_FCALL_BY_NAME:
604603
// op2 func
605604
if (func_slot[opline->op2.constant] >= 0) {
606605
opline->result.num = func_slot[opline->op2.constant];
@@ -610,6 +609,13 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
610609
func_slot[opline->op2.constant] = opline->result.num;
611610
}
612611
break;
612+
/* Do not compact runtime function cache for non qualified namespace calls */
613+
case ZEND_INIT_NS_FCALL_BY_NAME:
614+
// op2 func
615+
opline->result.num = cache_size;
616+
cache_size += sizeof(void *);
617+
func_slot[opline->op2.constant] = opline->result.num;
618+
break;
613619
case ZEND_INIT_METHOD_CALL:
614620
if (opline->op2_type == IS_CONST) {
615621
// op2 method

Zend/tests/autoloading/function/local_function_defined_after_pinned_to_global.phpt

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
--TEST--
22
Local function must be able to be defined after it got pinned to the global one
3-
--XFAIL--
4-
Currently fails under opcache as strlen() gets bound to the global function
53
--FILE--
64
<?php
75

0 commit comments

Comments
 (0)