merged master
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index e6fda96..d310879 100644 (file)
@@ -2372,8 +2372,13 @@ define( 'TS_ISO_8601_BASIC', 9 );
  * @return Mixed: String / false The same date in the format specified in $outputtype or false
  */
 function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) {
-       $timestamp = new MWTimestamp( $ts );
-       return $timestamp->getTimestamp( $outputtype );
+       try {
+               $timestamp = new MWTimestamp( $ts );
+               return $timestamp->getTimestamp( $outputtype );
+       } catch( TimestampException $e ) {
+               wfDebug("wfTimestamp() fed bogus time value: TYPE=$outputtype; VALUE=$ts\n");
+               return false;
+       }
 }
 
 /**