Skip to content

Commit 3f91365

Browse files
committed
REVIEW
1 parent 17a38c3 commit 3f91365

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

UPGRADING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ PHP 8.4 UPGRADE NOTES
4242
- XML:
4343
. The xml_set_*_handler() functions now declare and check for an effective
4444
signature of callable|string|null for the $handler parameters.
45-
Moreover, values of type string which correspond to method names,
45+
Moreover, values of type string that correspond to method names,
4646
of object set with xml_set_object() are now checked to see if the method
4747
exists on the class of the previously passed object.
4848
This means that xml_set_object() must now always be called prior to setting

ext/xml/xml.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,8 +1111,8 @@ PHP_FUNCTION(xml_set_element_handler)
11111111
zend_fcall_info_cache start_fcc = {0};
11121112
zend_fcall_info end_fci = {0};
11131113
zend_fcall_info_cache end_fcc = {0};
1114-
zend_string *method_name = NULL;
1115-
zend_string *method_name2 = NULL;
1114+
zend_string *start_method_name = NULL;
1115+
zend_string *end_method_name = NULL;
11161116

11171117
// TODO: cover trampolines with tests, as the !ZEND_FCC_INITIALIZED branches are never executed right now
11181118
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) {
@@ -1129,10 +1129,10 @@ PHP_FUNCTION(xml_set_element_handler)
11291129
* with it ourselves. It is important that it is not refetched on every call,
11301130
* because calls may occur from different scopes. */
11311131
}
1132-
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "Of!S", &pind, xml_parser_ce, &start_fci, &start_fcc, &method_name) == SUCCESS) {
1132+
} 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) {
11331133
parser = Z_XMLPARSER_P(pind);
11341134

1135-
bool status = php_xml_check_string_method_arg(3, parser, method_name, &start_fcc);
1135+
bool status = php_xml_check_string_method_arg(3, parser, end_method_name, &start_fcc);
11361136
if (status == false) {
11371137
RETURN_FALSE;
11381138
}
@@ -1143,10 +1143,10 @@ PHP_FUNCTION(xml_set_element_handler)
11431143
* with it ourselves. It is important that it is not refetched on every call,
11441144
* because calls may occur from different scopes. */
11451145
}
1146-
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "OSf!", &pind, xml_parser_ce, &method_name, &end_fci, &end_fcc) == SUCCESS) {
1146+
} 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) {
11471147
parser = Z_XMLPARSER_P(pind);
11481148

1149-
bool status = php_xml_check_string_method_arg(2, parser, method_name, &start_fcc);
1149+
bool status = php_xml_check_string_method_arg(2, parser, start_method_name, &start_fcc);
11501150
if (status == false) {
11511151
RETURN_FALSE;
11521152
}
@@ -1157,15 +1157,15 @@ PHP_FUNCTION(xml_set_element_handler)
11571157
* with it ourselves. It is important that it is not refetched on every call,
11581158
* because calls may occur from different scopes. */
11591159
}
1160-
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "OSS", &pind, xml_parser_ce, &method_name, &method_name2) == SUCCESS) {
1160+
} 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) {
11611161
parser = Z_XMLPARSER_P(pind);
11621162

1163-
bool status = php_xml_check_string_method_arg(2, parser, method_name, &start_fcc);
1163+
bool status = php_xml_check_string_method_arg(2, parser, start_method_name, &start_fcc);
11641164
if (status == false) {
11651165
RETURN_FALSE;
11661166
}
1167-
bool status2 = php_xml_check_string_method_arg(3, parser, method_name2, &end_fcc);
1168-
if (status2 == false) {
1167+
status = php_xml_check_string_method_arg(3, parser, end_method_name, &end_fcc);
1168+
if (status == false) {
11691169
RETURN_FALSE;
11701170
}
11711171
} else {
@@ -1219,10 +1219,9 @@ static void php_xml_set_handler_parse_callable(
12191219
}
12201220
memcpy(parser_handler_fcc, &handler_fcc, sizeof(zend_fcall_info_cache));
12211221
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "OS", &pind, xml_parser_ce, &method_name) == SUCCESS) {
1222-
xml_parser *local_parser;
1223-
*parser = local_parser = Z_XMLPARSER_P(pind);
1222+
*parser = Z_XMLPARSER_P(pind);
12241223

1225-
bool status = php_xml_check_string_method_arg(2, local_parser, method_name, parser_handler_fcc);
1224+
bool status = php_xml_check_string_method_arg(2, *parser, method_name, parser_handler_fcc);
12261225
if (status == false) {
12271226
RETURN_FALSE;
12281227
}

0 commit comments

Comments
 (0)