From: umherirrender Date: Sat, 5 Jan 2013 20:09:16 +0000 (+0100) Subject: fixed timestamp validation for api X-Git-Tag: 1.31.0-rc.0~21043^2 X-Git-Url: http://git.cyclocoop.org/%24dirpuce/puce%24spip_lang_rtl.gif?a=commitdiff_plain;h=b65a72da0b4ecddc2333cc0eef502c40db12e6e3;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 ); } /**