jenkins-bot has submitted this change and it was merged. Change subject: Parse lowercase ids in ByPropertyListUnserializer ......................................................................
Parse lowercase ids in ByPropertyListUnserializer Change-Id: Iac8f4e7cbda907fde186532fea0fbfa4894a322b --- M lib/includes/serializers/ByPropertyListUnserializer.php 1 file changed, 11 insertions(+), 3 deletions(-) Approvals: Aude: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/includes/serializers/ByPropertyListUnserializer.php b/lib/includes/serializers/ByPropertyListUnserializer.php index f6d5e52..5e2cb52 100644 --- a/lib/includes/serializers/ByPropertyListUnserializer.php +++ b/lib/includes/serializers/ByPropertyListUnserializer.php @@ -2,6 +2,8 @@ namespace Wikibase\Lib\Serializers; +use Wikibase\DataModel\Entity\PropertyId; +use Wikibase\Lib\EntityIdParser; use InvalidArgumentException; use OutOfBoundsException; @@ -47,18 +49,24 @@ */ public function newFromSerialization( array $serialization ) { $elements = array(); + $idParser = new EntityIdParser(); foreach ( $serialization as $propertyId => $byPropId ) { if ( !is_array( $byPropId ) ) { throw new InvalidArgumentException( "Element with key '$propertyId' should be an array, found " . gettype( $byPropId ) ); } + $propertyId = $idParser->parse( $propertyId ); + foreach ( $byPropId as $serializedElement ) { $element = $this->elementUnserializer->newFromSerialization( $serializedElement ); - $elementPropertyId = $element->getPropertyId()->getPrefixedId(); - if ( $elementPropertyId !== $propertyId ) { - throw new OutOfBoundsException( "Element with id '$elementPropertyId' found in list with id '$propertyId'" ); + /** @var PropertyId $elementPropertyId */ + $elementPropertyId = $element->getPropertyId(); + + if ( !$elementPropertyId->equals( $propertyId ) ) { + throw new OutOfBoundsException( "Element with id '" . $elementPropertyId->getSerialization() . + "' found in list with id '" . $propertyId->getSerialization() . "'" ); } $elements[] = $element; -- To view, visit https://gerrit.wikimedia.org/r/91086 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iac8f4e7cbda907fde186532fea0fbfa4894a322b Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Aude <aude.w...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits