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
This commit is contained in:
parent
fb1d2fe219
commit
b65a72da0b
1 changed files with 3 additions and 3 deletions
|
|
@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue