Anomie has uploaded a new change for review. https://gerrit.wikimedia.org/r/207766
Change subject: API: Also mangle indexed tag names in format=xml ...................................................................... API: Also mangle indexed tag names in format=xml I had thought no one would be silly enough to set invalid tag names for ApiResult::setIndexedTagName(), since it's specifically *for* XML tag names. Apparently I was wrong. Bug: T97599 Change-Id: I62ad832b1d8c23a275e5c67160f0b1febe5f3454 --- M includes/api/ApiFormatXml.php M tests/phpunit/includes/api/format/ApiFormatXmlTest.php 2 files changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/66/207766/1 diff --git a/includes/api/ApiFormatXml.php b/includes/api/ApiFormatXml.php index dbd5645..fa0bac3 100644 --- a/includes/api/ApiFormatXml.php +++ b/includes/api/ApiFormatXml.php @@ -130,7 +130,7 @@ ? $value[ApiResult::META_PRESERVE_KEYS] : array(); $indexedTagName = isset( $value[ApiResult::META_INDEXED_TAG_NAME] ) - ? $value[ApiResult::META_INDEXED_TAG_NAME] + ? self::mangleName( $value[ApiResult::META_INDEXED_TAG_NAME], $preserveKeys ) : '_v'; $bcBools = isset( $value[ApiResult::META_BC_BOOLS] ) ? $value[ApiResult::META_BC_BOOLS] diff --git a/tests/phpunit/includes/api/format/ApiFormatXmlTest.php b/tests/phpunit/includes/api/format/ApiFormatXmlTest.php index 0c31b95..7babaed 100644 --- a/tests/phpunit/includes/api/format/ApiFormatXmlTest.php +++ b/tests/phpunit/includes/api/format/ApiFormatXmlTest.php @@ -94,6 +94,8 @@ array( array( "foo\xe3\x80\x80bar" => 1 ), '<?xml version="1.0"?><api _foo.3000.bar="1" />' ), array( array( 'foo:bar' => 1, ApiResult::META_PRESERVE_KEYS => array( 'foo:bar' ) ), '<?xml version="1.0"?><api foo:bar="1" />' ), + array( array( 'a', 'b', ApiResult::META_INDEXED_TAG_NAME => 'foo bar' ), + '<?xml version="1.0"?><api><_foo.20.bar>a</_foo.20.bar><_foo.20.bar>b</_foo.20.bar></api>' ), // includenamespace param array( array( 'x' => 'foo' ), '<?xml version="1.0"?><api x="foo" xmlns="http://www.mediawiki.org/xml/api/" />', -- To view, visit https://gerrit.wikimedia.org/r/207766 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I62ad832b1d8c23a275e5c67160f0b1febe5f3454 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie <bjor...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits