Only use FastStringSearch on PHP <5.5
authorOri Livneh <ori@wikimedia.org>
Thu, 3 Sep 2015 20:31:39 +0000 (13:31 -0700)
committerKrinkle <krinklemail@gmail.com>
Thu, 3 Sep 2015 22:53:15 +0000 (22:53 +0000)
The native implementation of strtr( $str, $replace_pairs ) matches the
performance of FastStringSearch since http://bugs.php.net/63893 has been
resolved. HHVM's implementation does too, since PR facebook/hhvm#5471.

Change-Id: I20374d37bbb9958188a0487abc5b50f08ce40840

includes/libs/ReplacementArray.php

index 185914c..b6faa37 100644 (file)
@@ -111,7 +111,10 @@ class ReplacementArray {
         * @return string
         */
        public function replace( $subject ) {
-               if ( function_exists( 'fss_prep_replace' ) ) {
+               if (
+                       function_exists( 'fss_prep_replace' )  &&
+                       version_compare( PHP_VERSION, '5.5.0' ) < 0
+               ) {
                        if ( $this->fss === false ) {
                                $this->fss = fss_prep_replace( $this->data );
                        }