fixed timestamp validation for api
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 5 Jan 2013 20:09:16 +0000 (21:09 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 5 Jan 2013 20:09:16 +0000 (21:09 +0100)
wfTimestamp returns false on failure.

Renamed variable to output original input on failure and not the false

Change-Id: I39d31f35dae88b8a6e50ebee76a3be8722603ef3

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 );
        }
 
        /**