From: Ori Livneh Date: Mon, 23 May 2016 22:43:16 +0000 (-0700) Subject: collation: Remove suppressWarnings() for getSortKey() X-Git-Tag: 1.31.0-rc.0~6819^2 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=8fc4dea67935fb0fa40a08c3be43d124a763321a;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 ) {