Tobias Gritschacher has uploaded a new change for review.
https://gerrit.wikimedia.org/r/64937
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(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues
refs/changes/37/64937/1
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: newchange
Gerrit-Change-Id: I0055dddbb0b810432879d275e1e102069e7736c2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: mw1.22-wmf5
Gerrit-Owner: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: Denny Vrandecic <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits