Merge "fixed timestamp validation for api"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 14 Jan 2013 18:56:01 +0000 (18:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 14 Jan 2013 18:56:01 +0000 (18:56 +0000)
includes/api/ApiBase.php

index 1b176e7..ff93d2f 100644 (file)
@@ -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 );
        }
 
        /**