jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/344599 )
Change subject: Change bad ASCII to UTF-8 validation in terms/value validators
......................................................................
Change bad ASCII to UTF-8 validation in terms/value validators
We need to BACKPORT this. Not necesarrily the tests. I also believe the
changes to ValidatorBuilders are not deployed yet. So the only file that
needs backporting is TermValidatorFactory.
Bug: T161263
Change-Id: If129df5364afd03848d40658f605923d252e4a69
---
M repo/includes/ValidatorBuilders.php
M repo/includes/Validators/TermValidatorFactory.php
M repo/tests/phpunit/includes/Validators/TermValidatorFactoryTest.php
3 files changed, 4 insertions(+), 3 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
diff --git a/repo/includes/ValidatorBuilders.php
b/repo/includes/ValidatorBuilders.php
index 31e3e91..9e193e2 100644
--- a/repo/includes/ValidatorBuilders.php
+++ b/repo/includes/ValidatorBuilders.php
@@ -176,7 +176,7 @@
$validators[] = new TypeValidator( 'string' );
//TODO: validate UTF8 (here and elsewhere)
$validators[] = new StringLengthValidator( 1, $maxLength,
'mb_strlen' );
- $validators[] = new RegexValidator( '/^\s|[\r\n\t]|\s$/', true
); // no leading/trailing whitespace, no line breaks.
+ $validators[] = new RegexValidator( '/^\s|[\r\n\t]|\s$/u', true
); // no leading/trailing whitespace, no line breaks.
return $validators;
}
diff --git a/repo/includes/Validators/TermValidatorFactory.php
b/repo/includes/Validators/TermValidatorFactory.php
index 3fa10c3..1cc80e7 100644
--- a/repo/includes/Validators/TermValidatorFactory.php
+++ b/repo/includes/Validators/TermValidatorFactory.php
@@ -128,7 +128,7 @@
$validators = array();
$validators[] = new TypeValidator( 'string' );
$validators[] = new StringLengthValidator( 1, $this->maxLength,
'mb_strlen' );
- $validators[] = new RegexValidator( '/^\s|[\v\t]|\s$/', true );
// no leading/trailing whitespace, no line breaks.
+ $validators[] = new RegexValidator( '/^\s|[\v\t]|\s$/u', true
); // no leading/trailing whitespace, no line breaks.
return $validators;
}
diff --git
a/repo/tests/phpunit/includes/Validators/TermValidatorFactoryTest.php
b/repo/tests/phpunit/includes/Validators/TermValidatorFactoryTest.php
index ae513b5..5214e38 100644
--- a/repo/tests/phpunit/includes/Validators/TermValidatorFactoryTest.php
+++ b/repo/tests/phpunit/includes/Validators/TermValidatorFactoryTest.php
@@ -111,6 +111,7 @@
return [
'Space' => [ 'x x', true ],
'Unicode support' => [ 'Äöü', true ],
+ 'T161263' => [ 'Ӆ', true ],
// Length checks
'To short' => [ '', false ],
@@ -130,7 +131,7 @@
'U+000B: Vertical tab' => [ "x\x0Bx", false ],
'U+000C: Form feed' => [ "x\fx", false ],
'U+000D: Return' => [ "x\rx", false ],
- 'U+0085: Next line' => [ "x\x85x", false ],
+ 'U+0085: Next line' => [ "x\xC2\x85x", false ],
];
}
--
To view, visit https://gerrit.wikimedia.org/r/344599
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If129df5364afd03848d40658f605923d252e4a69
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: wmf/1.29.0-wmf.17
Gerrit-Owner: Ladsgroup <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits