From b7db9837bf4fc1ec1ecf6bc5a030b2d59f522878 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 4 Dec 2005 21:15:04 +0000 Subject: [PATCH] some useless calls / unitialized $matches arrays --- includes/HttpFunctions.php | 1 + includes/Licenses.php | 14 ++++++++------ includes/MagicWord.php | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 87e2a86792..f4d00e5a5c 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -53,6 +53,7 @@ function wfIsLocalURL( $url ) { } // Extract host part + $matches = array(); if ( preg_match( '!^http://([\w.-]+)[/:].*$!', $url, $matches ) ) { $host = $matches[1]; // Split up dotwise diff --git a/includes/Licenses.php b/includes/Licenses.php index 4294e2f489..36b5a7e846 100644 --- a/includes/Licenses.php +++ b/includes/Licenses.php @@ -54,24 +54,26 @@ class Licenses { $lines = explode( "\n", $this->msg ); foreach ( $lines as $line ) { - if ( strpos( $line, '*' ) !== 0 ) + if ( strpos( $line, '*' ) !== 0 ) { continue; - else { + } else { list( $level, $line ) = $this->trimStars( $line ); if ( strpos( $line, '|' ) !== false ) { $obj = new License( $line ); $this->stackItem( $this->licenses, $levels, $obj ); } else { - if ( $level < count( $levels ) ) + if ( $level < count( $levels ) ) { $levels = array_slice( $levels, 0, $level ); - if ( $level == count( $levels ) ) + } + if ( $level == count( $levels ) ) { $levels[$level - 1] = $line; - else if ( $level > count( $levels ) ) + } elseif ( $level > count( $levels ) ) { $levels[] = $line; + } } } - } + } // end foreach } function trimStars( $str ) { diff --git a/includes/MagicWord.php b/includes/MagicWord.php index d5e3ca0dde..7d38b0ee75 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -234,6 +234,7 @@ class MagicWord { * is one. */ function matchVariableStartToEnd( $text ) { + $matches = array(); $matchcount = preg_match( $this->getVariableStartToEndRegex(), $text, $matches ); if ( $matchcount == 0 ) { return NULL; @@ -282,7 +283,6 @@ class MagicWord { * Input word must contain $1 */ function substituteCallback( $text, $callback ) { - $regex = $this->getVariableRegex(); $res = preg_replace_callback( $this->getVariableRegex(), $callback, $text ); $this->mModified = !($res === $text); return $res; -- 2.20.1