r80797 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80796‎ | r80797 | r80798 >
Date:09:20, 23 January 2011
Author:reedy
Status:ok
Tags:
Comment:
Few paramter explicit definition for preg calls

Move creation of $dbw variable earlier, to fix undefined on one code path
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRepository.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/Subversion.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -439,6 +439,7 @@
440440 */
441441 public function getAffectedRevs() {
442442 $affectedRevs = array();
 443+ $m = array();
443444 if ( preg_match_all( '/\br(\d{2,})\b/', $this->mMessage, $m ) ) {
444445 foreach ( $m[1] as $rev ) {
445446 $affectedRev = intval( $rev );
@@ -456,8 +457,11 @@
457458 * @return array
458459 */
459460 public function getAffectedBugRevs() {
 461+ $dbw = wfGetDB( DB_MASTER );
 462+
460463 // Update bug references table...
461464 $affectedBugs = array();
 465+ $m = array();
462466 if ( preg_match_all( '/\bbug (\d+)\b/', $this->mMessage, $m ) ) {
463467 $data = array();
464468 foreach ( $m[1] as $bug ) {
@@ -468,7 +472,6 @@
469473 );
470474 $affectedBugs[] = intval( $bug );
471475 }
472 - $dbw = wfGetDB( DB_MASTER );
473476 $dbw->insert( 'code_bugs', $data, __METHOD__, array( 'IGNORE' ) );
474477 }
475478
Index: trunk/extensions/CodeReview/backend/CodeRepository.php
@@ -284,8 +284,7 @@
285285 $paths = $revision->getModifiedPaths();
286286 if ( !$paths->numRows() ) {
287287 $data = DIFFRESULT_NothingToCompare;
288 - }
289 - elseif ( $wgCodeReviewMaxDiffPaths > 0 && $paths->numRows() > $wgCodeReviewMaxDiffPaths ) {
 288+ } elseif ( $wgCodeReviewMaxDiffPaths > 0 && $paths->numRows() > $wgCodeReviewMaxDiffPaths ) {
290289 $data = DIFFRESULT_TooManyPaths;
291290 }
292291 }
Index: trunk/extensions/CodeReview/backend/Subversion.php
@@ -204,6 +204,7 @@
205205 $i = 0;
206206 foreach ( $formats as $key => $regex ) {
207207 $text = $bits[$i++];
 208+ $matches = array();
208209 if ( preg_match( $regex, $text, $matches ) ) {
209210 $data[$key] = $matches[1];
210211 } else {
@@ -231,6 +232,7 @@
232233 // Out of paths. Move on to the message...
233234 $state = 'msg';
234235 } else {
 236+ $matches = array();
235237 if ( preg_match( '/^ (.) (.*)$/', $line, $matches ) ) {
236238 $data['paths'][] = array(
237239 'action' => $matches[1],

Status & tagging log