}
$value = $this->getMain()->getCheck( $encParamName );
+ $provided = $value;
} elseif ( $type == 'upload' ) {
if ( isset( $default ) ) {
// Having a default value is not allowed
self::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" );
}
$value = $this->getMain()->getUpload( $encParamName );
+ $provided = $value->exists();
if ( !$value->exists() ) {
// This will get the value without trying to normalize it
// (because trying to normalize a large binary file
}
} else {
$value = $this->getMain()->getVal( $encParamName, $default );
+ $provided = $this->getMain()->getCheck( $encParamName );
if ( isset( $value ) && $type == 'namespace' ) {
$type = MWNamespace::getValidNamespaces();
}
// Set a warning if a deprecated parameter has been passed
- if ( $deprecated && $value !== false ) {
+ if ( $deprecated && $provided ) {
$feature = $encParamName;
$m = $this;
while ( !$m->isMain() ) {
}
// Set a warning if a deprecated parameter value has been passed
- $usedDeprecatedValues = $deprecatedValues && $value !== false
+ $usedDeprecatedValues = $deprecatedValues && $provided
? array_intersect( array_keys( $deprecatedValues ), (array)$value )
: [];
if ( $usedDeprecatedValues ) {
'foo',
[ [ 'apiwarn-deprecation-parameter', 'myParam' ] ],
],
+ 'Deprecated parameter with default, unspecified' => [
+ null,
+ [ ApiBase::PARAM_DEPRECATED => true, ApiBase::PARAM_DFLT => 'foo' ],
+ 'foo',
+ [],
+ ],
+ 'Deprecated parameter with default, specified' => [
+ 'foo',
+ [ ApiBase::PARAM_DEPRECATED => true, ApiBase::PARAM_DFLT => 'foo' ],
+ 'foo',
+ [ [ 'apiwarn-deprecation-parameter', 'myParam' ] ],
+ ],
'Deprecated parameter value' => [
'a',
[ ApiBase::PARAM_DEPRECATED_VALUES => [ 'a' => true ] ],
'a',
[ [ 'apiwarn-deprecation-parameter', 'myParam=a' ] ],
],
+ 'Deprecated parameter value as default, unspecified' => [
+ null,
+ [ ApiBase::PARAM_DEPRECATED_VALUES => [ 'a' => true ], ApiBase::PARAM_DFLT => 'a' ],
+ 'a',
+ [],
+ ],
+ 'Deprecated parameter value as default, specified' => [
+ 'a',
+ [ ApiBase::PARAM_DEPRECATED_VALUES => [ 'a' => true ], ApiBase::PARAM_DFLT => 'a' ],
+ 'a',
+ [ [ 'apiwarn-deprecation-parameter', 'myParam=a' ] ],
+ ],
'Multiple deprecated parameter values' => [
'a|b|c|d',
[ ApiBase::PARAM_DEPRECATED_VALUES =>