diff options
author | Tim Starling <tstarling@wikimedia.org> | 2021-05-06 11:06:02 +1000 |
---|---|---|
committer | Tim Starling <tstarling@wikimedia.org> | 2021-05-06 11:56:12 +1000 |
commit | c5390fcefcad684b2644efbfe454dab3375f8155 (patch) | |
tree | eb072807055d2ec513d4213517c8ac63225115fe /includes | |
parent | f808e7dc4ac6f0426f835b9e52481d89e1dd5b80 (diff) | |
download | mediawikicore-c5390fcefcad684b2644efbfe454dab3375f8155.tar.gz mediawikicore-c5390fcefcad684b2644efbfe454dab3375f8155.zip |
Remove harmful validation regex in PageReferenceValue
Catching common issues here instead of where the caller expects breaks
log formatting, including complete breakage of Special:RecentChanges.
The doc comment says that validation is the caller's responsibility,
which seems like a good idea to me.
Bug: T282070
Change-Id: Ic7e5c5576564e61906a812d50ea4e48adf5ac998
Diffstat (limited to 'includes')
-rw-r--r-- | includes/page/PageReferenceValue.php | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/includes/page/PageReferenceValue.php b/includes/page/PageReferenceValue.php index 7646e237bfec..5a9032aa12e4 100644 --- a/includes/page/PageReferenceValue.php +++ b/includes/page/PageReferenceValue.php @@ -65,16 +65,9 @@ class PageReferenceValue implements PageReference { Assert::parameter( $dbKey !== '', '$dbKey', 'must not be empty' ); - // Don't be mad about spaces. + // Replace spaces with underscores $dbKey = str_replace( ' ', '_', $dbKey ); - // Not full validation, but catches commons issues: - Assert::parameter( - !preg_match( '/[\s#|]/', $dbKey ), - '$dbKey', - 'must be a valid title: ' . $dbKey - ); - $this->wikiId = $wikiId; $this->namespace = $namespace; $this->dbKey = $dbKey; |