Denny Vrandecic has submitted this change and it was merged. Change subject: trim incoming string values ......................................................................
trim incoming string values Change-Id: I0055dddbb0b810432879d275e1e102069e7736c2 --- M DataValues/includes/values/StringValue.php M DataValues/tests/phpunit/includes/values/StringValueTest.php 2 files changed, 5 insertions(+), 2 deletions(-) Approvals: Denny Vrandecic: Looks good to me, approved jenkins-bot: Verified diff --git a/DataValues/includes/values/StringValue.php b/DataValues/includes/values/StringValue.php index 678fa6d..3c57840 100644 --- a/DataValues/includes/values/StringValue.php +++ b/DataValues/includes/values/StringValue.php @@ -63,7 +63,10 @@ throw new InvalidArgumentException( 'String length exceeds limit of 400 characters' ); } - $this->value = $value; + // The trim is not at the right place, but the right place would either need us to have + // the parsers or the options in place. So for now it seems that it is not hurting much + // here. It is only in the deployment branch. Like the one in the previous line of code. + $this->value = trim( $value ); } /** diff --git a/DataValues/tests/phpunit/includes/values/StringValueTest.php b/DataValues/tests/phpunit/includes/values/StringValueTest.php index 3b588a1..ea0227d 100644 --- a/DataValues/tests/phpunit/includes/values/StringValueTest.php +++ b/DataValues/tests/phpunit/includes/values/StringValueTest.php @@ -64,7 +64,7 @@ $argLists[] = array( false, null ); $argLists[] = array( true, 'foo' ); $argLists[] = array( true, '' ); - $argLists[] = array( true, ' foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz ' ); + $argLists[] = array( true, 'foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz foo bar baz' ); return $argLists; } -- To view, visit https://gerrit.wikimedia.org/r/64937 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0055dddbb0b810432879d275e1e102069e7736c2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DataValues Gerrit-Branch: mw1.22-wmf5 Gerrit-Owner: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> Gerrit-Reviewer: Denny Vrandecic <denny.vrande...@wikimedia.de> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits