r68655 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68654‎ | r68655 | r68656 >
Date:12:02, 28 June 2010
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
One place forgot intval() mLatestID causing bugs with strict comparisons. Fixed it and added extra intval() conversion.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -240,7 +240,7 @@
241241 $t->mArticleID = isset( $row->page_id ) ? intval( $row->page_id ) : -1;
242242 $t->mLength = isset( $row->page_len ) ? intval( $row->page_len ) : -1;
243243 $t->mRedirect = isset( $row->page_is_redirect ) ? (bool)$row->page_is_redirect : null;
244 - $t->mLatestID = isset( $row->page_latest ) ? $row->page_latest : false;
 244+ $t->mLatestID = isset( $row->page_latest ) ? intval( $row->page_latest ) : false;
245245
246246 return $t;
247247 }
@@ -2330,7 +2330,7 @@
23312331 */
23322332 public function getLatestRevID( $flags = 0 ) {
23332333 if ( $this->mLatestID !== false )
2334 - return $this->mLatestID;
 2334+ return intval( $this->mLatestID );
23352335 # Calling getArticleID() loads the field from cache as needed
23362336 if ( !$this->getArticleID( $flags ) ) {
23372337 return $this->mLatestID = 0;

Comments

#Comment by Nikerabbit (talk | contribs)   12:07, 28 June 2010

More specifically causes at least one bug in Translate extension. 1.16 branch has the same issue even though the code has changed a bit since then.

Status & tagging log