Tobias Gritschacher has submitted this change and it was merged. Change subject: Parse lowercase ids in ByPropertyListUnserializer ......................................................................
Parse lowercase ids in ByPropertyListUnserializer (cherry picked from commit c1f56396f95e3d42dfc04038f28bf7af1dffa368) Change-Id: Iac8f4e7cbda907fde186532fea0fbfa4894a322b --- M lib/includes/serializers/ByPropertyListUnserializer.php 1 file changed, 11 insertions(+), 4 deletions(-) Approvals: Tobias Gritschacher: Verified; Looks good to me, approved diff --git a/lib/includes/serializers/ByPropertyListUnserializer.php b/lib/includes/serializers/ByPropertyListUnserializer.php index 3f2ac41..978ec12 100644 --- a/lib/includes/serializers/ByPropertyListUnserializer.php +++ b/lib/includes/serializers/ByPropertyListUnserializer.php @@ -2,6 +2,8 @@ namespace Wikibase\Lib\Serializers; use ApiResult, MWException; +use Wikibase\DataModel\Entity\PropertyId; +use Wikibase\Lib\EntityIdParser; /** * Serializer for Traversable objects that need to be grouped @@ -62,19 +64,24 @@ */ public function newFromSerialization( array $serialization ) { $elements = array(); + $idParser = new EntityIdParser(); foreach ( $serialization as $propertyId => $byPropId ) { if ( !is_array( $byPropId ) ) { throw new MWException( "Element with key '$propertyId' should be an array, found " . gettype( $byPropId ) ); } + $propertyId = $idParser->parse( $propertyId ); + foreach ( $byPropId as $serializedElement ) { $element = $this->elementUnserializer->newFromSerialization( $serializedElement ); - // FIXME: usage of deprecated method getPrefixedId - $elementPropertyId = $element->getPropertyId()->getPrefixedId(); - if ( $elementPropertyId !== $propertyId ) { - throw new MWException( "Element with id '$elementPropertyId' found in list with id '$propertyId'" ); + /** @var PropertyId $elementPropertyId */ + $elementPropertyId = $element->getPropertyId(); + + if ( !$elementPropertyId->equals( $propertyId ) ) { + throw new MWException( "Element with id '" . $elementPropertyId->getSerialization() . + "' found in list with id '" . $propertyId->getSerialization() . "'" ); } $elements[] = $element; -- To view, visit https://gerrit.wikimedia.org/r/91088 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iac8f4e7cbda907fde186532fea0fbfa4894a322b Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: mw1.22-wmf21 Gerrit-Owner: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Aude <aude.w...@gmail.com> Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits