Measure string length once in Parser::replaceVariables
authorOri Livneh <ori@wikimedia.org>
Wed, 9 Sep 2015 01:48:33 +0000 (18:48 -0700)
committerOri.livneh <ori@wikimedia.org>
Wed, 9 Sep 2015 23:52:32 +0000 (23:52 +0000)
Change-Id: I5b1e3f3fa06cb4e2982f3c0d24222ba2ee59ea47

includes/parser/Parser.php

index 664f0a4..ab5c586 100644 (file)
@@ -3326,7 +3326,8 @@ class Parser {
         */
        public function replaceVariables( $text, $frame = false, $argsOnly = false ) {
                # Is there any text? Also, Prevent too big inclusions!
-               if ( strlen( $text ) < 1 || strlen( $text ) > $this->mOptions->getMaxIncludeSize() ) {
+               $textSize = strlen( $text );
+               if ( $textSize < 1 || $textSize > $this->mOptions->getMaxIncludeSize() ) {
                        return $text;
                }