@@ -1157,49 +1157,35 @@ PHP_FUNCTION(xml_set_element_handler)
1157
1157
zend_string * start_method_name = NULL ;
1158
1158
zend_string * end_method_name = NULL ;
1159
1159
1160
- if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "Of!f !" , & pind , xml_parser_ce , & start_fci , & start_fcc , & end_fci , & end_fcc ) == SUCCESS ) {
1160
+ if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "OF!F !" , & pind , xml_parser_ce , & start_fci , & start_fcc , & end_fci , & end_fcc ) == SUCCESS ) {
1161
1161
parser = Z_XMLPARSER_P (pind );
1162
- if (ZEND_FCI_INITIALIZED (start_fci ) && !ZEND_FCC_INITIALIZED (start_fcc )) {
1163
- zend_is_callable_ex (& start_fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & start_fcc , NULL );
1164
- /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1165
- * with it ourselves. It is important that it is not refetched on every call,
1166
- * because calls may occur from different scopes. */
1167
- }
1168
- if (ZEND_FCI_INITIALIZED (end_fci ) && !ZEND_FCC_INITIALIZED (end_fcc )) {
1169
- zend_is_callable_ex (& end_fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & end_fcc , NULL );
1170
- /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1171
- * with it ourselves. It is important that it is not refetched on every call,
1172
- * because calls may occur from different scopes. */
1173
- }
1174
- } else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "Of!S" , & pind , xml_parser_ce , & start_fci , & start_fcc , & end_method_name ) == SUCCESS ) {
1162
+ goto set_handlers ;
1163
+ }
1164
+ zend_release_fcall_info_cache (& start_fcc );
1165
+ zend_release_fcall_info_cache (& end_fcc );
1166
+
1167
+ if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "OF!S" , & pind , xml_parser_ce , & start_fci , & start_fcc , & end_method_name ) == SUCCESS ) {
1175
1168
parser = Z_XMLPARSER_P (pind );
1176
1169
1177
1170
bool status = php_xml_check_string_method_arg (3 , parser -> object , end_method_name , & end_fcc );
1178
1171
if (status == false) {
1172
+ zend_release_fcall_info_cache (& start_fcc );
1173
+ zend_release_fcall_info_cache (& end_fcc );
1179
1174
RETURN_THROWS ();
1180
1175
}
1181
-
1182
- if (ZEND_FCI_INITIALIZED (start_fci ) && !ZEND_FCC_INITIALIZED (start_fcc )) {
1183
- zend_is_callable_ex (& start_fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & start_fcc , NULL );
1184
- /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1185
- * with it ourselves. It is important that it is not refetched on every call,
1186
- * because calls may occur from different scopes. */
1187
- }
1188
- } else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "OSf!" , & pind , xml_parser_ce , & start_method_name , & end_fci , & end_fcc ) == SUCCESS ) {
1176
+ } else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "OSF!" , & pind , xml_parser_ce , & start_method_name , & end_fci , & end_fcc ) == SUCCESS ) {
1189
1177
parser = Z_XMLPARSER_P (pind );
1190
1178
1191
1179
bool status = php_xml_check_string_method_arg (2 , parser -> object , start_method_name , & start_fcc );
1192
1180
if (status == false) {
1181
+ zend_release_fcall_info_cache (& start_fcc );
1182
+ zend_release_fcall_info_cache (& end_fcc );
1193
1183
RETURN_THROWS ();
1194
1184
}
1195
-
1196
- if (ZEND_FCI_INITIALIZED (end_fci ) && !ZEND_FCC_INITIALIZED (end_fcc )) {
1197
- zend_is_callable_ex (& end_fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & end_fcc , NULL );
1198
- /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1199
- * with it ourselves. It is important that it is not refetched on every call,
1200
- * because calls may occur from different scopes. */
1201
- }
1202
1185
} else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "OSS" , & pind , xml_parser_ce , & start_method_name , & end_method_name ) == SUCCESS ) {
1186
+ zend_release_fcall_info_cache (& start_fcc );
1187
+ zend_release_fcall_info_cache (& end_fcc );
1188
+
1203
1189
parser = Z_XMLPARSER_P (pind );
1204
1190
1205
1191
bool status = php_xml_check_string_method_arg (2 , parser -> object , start_method_name , & start_fcc );
@@ -1213,6 +1199,9 @@ PHP_FUNCTION(xml_set_element_handler)
1213
1199
} else {
1214
1200
zval * dummy_start ;
1215
1201
zval * dummy_end ;
1202
+
1203
+ zend_release_fcall_info_cache (& start_fcc );
1204
+ zend_release_fcall_info_cache (& end_fcc );
1216
1205
if (zend_parse_parameters (ZEND_NUM_ARGS (), "Ozz" , & pind , xml_parser_ce , & dummy_start , & dummy_end ) == FAILURE ) {
1217
1206
RETURN_THROWS ();
1218
1207
} else {
@@ -1229,6 +1218,7 @@ PHP_FUNCTION(xml_set_element_handler)
1229
1218
}
1230
1219
}
1231
1220
1221
+ set_handlers :
1232
1222
xml_set_handler (& parser -> startElementHandler , & start_fcc );
1233
1223
xml_set_handler (& parser -> endElementHandler , & end_fcc );
1234
1224
XML_SetElementHandler (parser -> parser , _xml_startElementHandler , _xml_endElementHandler );
@@ -1247,18 +1237,12 @@ static void php_xml_set_handler_parse_callable(
1247
1237
zend_fcall_info_cache handler_fcc = {0 };
1248
1238
zend_string * method_name = NULL ;
1249
1239
1250
- if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "Of !" , & pind , xml_parser_ce , & handler_fci , & handler_fcc ) == SUCCESS ) {
1240
+ if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "OF !" , & pind , xml_parser_ce , & handler_fci , & handler_fcc ) == SUCCESS ) {
1251
1241
* parser = Z_XMLPARSER_P (pind );
1252
1242
if (!ZEND_FCI_INITIALIZED (handler_fci )) {
1253
1243
/* Free handler, so just return and a uninitialized FCC communicates this */
1254
1244
return ;
1255
1245
}
1256
- if (!ZEND_FCC_INITIALIZED (handler_fcc )) {
1257
- zend_is_callable_ex (& handler_fci .function_name , NULL , IS_CALLABLE_SUPPRESS_DEPRECATIONS , NULL , & handler_fcc , NULL );
1258
- /* Call trampoline has been cleared by zpp. Refetch it, because we want to deal
1259
- * with it ourselves. It is important that it is not refetched on every call,
1260
- * because calls may occur from different scopes. */
1261
- }
1262
1246
memcpy (parser_handler_fcc , & handler_fcc , sizeof (zend_fcall_info_cache ));
1263
1247
} else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "OS" , & pind , xml_parser_ce , & method_name ) == SUCCESS ) {
1264
1248
* parser = Z_XMLPARSER_P (pind );
0 commit comments