summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 16b24ca17a..67a6d27e1c 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2190,6 +2190,19 @@ void zend_do_early_binding(TSRMLS_D)
if (do_bind_inherited_class(opline, CG(class_table), *pce, 1 TSRMLS_CC) == NULL) {
return;
}
+ /* clear unnecessary ZEND_FETCH_CLASS opcode */
+ if (opline > CG(active_op_array)->opcodes &&
+ (opline-1)->opcode == ZEND_FETCH_CLASS) {
+ zend_op *fetch_class_opline = opline-1;
+
+ zval_dtor(&fetch_class_opline->op2.u.constant);
+ fetch_class_opline->opcode = ZEND_NOP;
+ memset(&fetch_class_opline->op1, 0, sizeof(znode));
+ memset(&fetch_class_opline->op2, 0, sizeof(znode));
+ SET_UNUSED(fetch_class_opline->op1);
+ SET_UNUSED(fetch_class_opline->op2);
+ SET_UNUSED(fetch_class_opline->result);
+ }
} else {
/* We currently don't early-bind classes that implement interfaces */
return;