r68334 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68333‎ | r68334 | r68335 >
Date:17:57, 20 June 2010
Author:mkroetzsch
Status:deferred
Tags:
Comment:
improved checks when loading dates (otherwise rare errors can happen if a DB value that was stored for another datatype is loaded by an object of this class since the property type changed in the meantime without the stored values having been updated yet)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Time.php
@@ -447,7 +447,10 @@
448448 protected function parseDBkeys( $args ) {
449449 $this->m_caption = false;
450450 if ( count( $args ) < 2 ) return;
451 - list( $date, $this->m_time ) = explode( 'T', $args[0], 2 );
 451+ $timeparts = explode( 'T', $args[0], 2 );
 452+ if ( count( $timeparts ) != 2 ) return;
 453+ $date = reset( $timeparts );
 454+ $this->m_time = end( $timeparts );
452455 $d = explode( '/', $date, 3 );
453456 if ( count( $d ) == 3 ) list( $this->m_year, $this->m_month, $this->m_day ) = $d;
454457 elseif ( count( $d ) == 2 ) list( $this->m_year, $this->m_month ) = $d;

Status & tagging log