From 8fc4dea67935fb0fa40a08c3be43d124a763321a Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Mon, 23 May 2016 15:43:16 -0700 Subject: [PATCH] collation: Remove suppressWarnings() for getSortKey() Small optimization to IcuCollation::fetchFirstLetterData(). This used to suppress / restore warnings once per every letter of every alphabet. The workaround for string casting and error suppression is no longer needed as of PHP 5.3, in which the bug was fixed. Change-Id: Idd41a509858c0887df4f632b480b387bd74027b2 --- includes/collation/IcuCollation.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/includes/collation/IcuCollation.php b/includes/collation/IcuCollation.php index a374b13168..f6a9dc76c5 100644 --- a/includes/collation/IcuCollation.php +++ b/includes/collation/IcuCollation.php @@ -188,20 +188,11 @@ class IcuCollation extends Collation { } public function getSortKey( $string ) { - // intl extension produces non null-terminated - // strings. Appending '' fixes it so that it doesn't generate - // a warning on each access in debug php. - MediaWiki\suppressWarnings(); - $key = $this->mainCollator->getSortKey( $string ) . ''; - MediaWiki\restoreWarnings(); - return $key; + return $this->mainCollator->getSortKey( $string ); } public function getPrimarySortKey( $string ) { - MediaWiki\suppressWarnings(); - $key = $this->primaryCollator->getSortKey( $string ) . ''; - MediaWiki\restoreWarnings(); - return $key; + return $this->primaryCollator->getSortKey( $string ); } public function getFirstLetter( $string ) { -- 2.20.1