@@ -71,8 +71,6 @@ static void zend_delete_call_instructions(zend_op *opline)
71
71
break ;
72
72
case ZEND_SEND_VAL :
73
73
case ZEND_SEND_VAR :
74
- case ZEND_SEND_VAR_NO_REF :
75
- case ZEND_SEND_REF :
76
74
if (call == 0 ) {
77
75
if (opline -> op1_type == IS_CONST ) {
78
76
MAKE_NOP (opline );
@@ -102,24 +100,36 @@ static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_o
102
100
zend_op * ret_opline = func -> op_array .opcodes + func -> op_array .num_args ;
103
101
104
102
if (ret_opline -> op1_type == IS_CONST ) {
103
+ uint32_t i , num_args = func -> op_array .num_args ;
104
+ num_args += (func -> op_array .fn_flags & ZEND_ACC_VARIADIC ) != 0 ;
105
105
106
106
if (fcall -> opcode == ZEND_INIT_METHOD_CALL && fcall -> op1_type == IS_UNUSED ) {
107
107
/* TODO: we can't inlne methods, because $this may be used
108
108
* not in object context ???
109
109
*/
110
110
return ;
111
111
}
112
+
113
+ for (i = 0 ; i < num_args ; i ++ ) {
114
+ /* Don't inline functions with by-reference arguments. This would require
115
+ * correct handling of INDIRECT arguments. */
116
+ if (func -> op_array .arg_info [i ].pass_by_reference ) {
117
+ return ;
118
+ }
119
+ }
120
+
112
121
if (fcall -> extended_value < func -> op_array .num_args ) {
113
122
/* don't inline funcions with named constants in default arguments */
114
- uint32_t n = fcall -> extended_value ;
123
+ i = fcall -> extended_value ;
115
124
116
125
do {
117
- if (Z_CONSTANT_P (RT_CONSTANT (& func -> op_array , func -> op_array .opcodes [n ].op2 ))) {
126
+ if (Z_CONSTANT_P (RT_CONSTANT (& func -> op_array , func -> op_array .opcodes [i ].op2 ))) {
118
127
return ;
119
128
}
120
- n ++ ;
121
- } while (n < func -> op_array .num_args );
129
+ i ++ ;
130
+ } while (i < func -> op_array .num_args );
122
131
}
132
+
123
133
if (RETURN_VALUE_USED (opline )) {
124
134
zval zv ;
125
135
0 commit comments