From b65a72da0b4ecddc2333cc0eef502c40db12e6e3 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 5 Jan 2013 21:09:16 +0100 Subject: [PATCH] fixed timestamp validation for api wfTimestamp returns false on failure. Renamed variable to output original input on failure and not the false Change-Id: I39d31f35dae88b8a6e50ebee76a3be8722603ef3 --- includes/api/ApiBase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 1b176e7f1e..ff93d2ffd7 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1152,11 +1152,11 @@ abstract class ApiBase extends ContextSource { * @return string */ function validateTimestamp( $value, $paramName ) { - $value = wfTimestamp( TS_UNIX, $value ); - if ( $value === 0 ) { + $unixTimestamp = wfTimestamp( TS_UNIX, $value ); + if ( $unixTimestamp === false ) { $this->dieUsage( "Invalid value '$value' for timestamp parameter $paramName", "badtimestamp_{$paramName}" ); } - return wfTimestamp( TS_MW, $value ); + return wfTimestamp( TS_MW, $unixTimestamp ); } /** -- 2.20.1