This is inspired by Ib117e05.
As far as I can tell this is functionally identical. Even arrays should
behave the same, as both the getVal() and getCheck() methods do have a
special case that returns the `null` default in case the user tried to
pass multiple values instead of a single scalar.
Change-Id: Id4e4ec91f39d3c39461bd41673bdafc3bde11737
} elseif ( $this->section == 'new' ) {
// Nothing *to* preview for new sections
return false;
- } elseif ( ( $request->getVal( 'preload' ) !== null || $this->mTitle->exists() )
+ } elseif ( ( $request->getCheck( 'preload' ) || $this->mTitle->exists() )
&& $this->context->getUser()->getOption( 'previewonfirst' )
) {
// Standard preference behavior
$this->scrolltop = $request->getIntOrNull( 'wpScrolltop' );
- if ( $this->textbox1 === '' && $request->getVal( 'wpTextbox1' ) === null ) {
+ if ( $this->textbox1 === '' && !$request->getCheck( 'wpTextbox1' ) ) {
// wpTextbox1 field is missing, possibly due to being "too big"
// according to some filter rules such as Suhosin's setting for
// suhosin.request.max_value_length (d'oh)
if ( $request->getVal( 'action', 'view' ) != 'view'
|| $request->wasPosted()
- || ( $request->getVal( 'title' ) !== null
+ || ( $request->getCheck( 'title' )
&& $title->getPrefixedDBkey() == $request->getVal( 'title' ) )
|| count( $request->getValueNames( [ 'action', 'title' ] ) )
|| !Hooks::run( 'TestCanonicalRedirect', [ $request, $title, $output ] )
$request = $this->getRequest();
// JSONP mode
- if ( $request->getVal( 'callback' ) !== null ) {
+ if ( $request->getCheck( 'callback' ) ) {
$this->lacksSameOriginSecurity = true;
return true;
}
// Fetch the value in either one of the two following case:
// - we have a valid submit attempt (form was just submitted)
// - we have a value (an URL manually built by the user, or GET form with no wpFormIdentifier)
- if ( $this->isSubmitAttempt( $request ) || $request->getVal( $this->mName ) !== null ) {
+ if ( $this->isSubmitAttempt( $request ) || $request->getCheck( $this->mName ) ) {
return $invert
? !$request->getBool( $this->mName )
: $request->getBool( $this->mName );
$this->load();
// TODO: This performs database actions on GET request, which is going to
// be a problem for our multi-datacenter work.
- if ( !is_null( $request->getVal( 'nsRemember' ) ) ) {
+ if ( $request->getCheck( 'nsRemember' ) ) {
$this->saveNamespaces();
// Remove the token from the URL to prevent the user from inadvertently
// exposing it (e.g. by pasting it into a public wiki page) or undoing
}
$this->searchEngineType = $request->getVal( 'srbackend' );
- if (
- !$request->getVal( 'fulltext' ) &&
- $request->getVal( 'offset' ) === null
- ) {
+ if ( !$request->getVal( 'fulltext' ) && !$request->getCheck( 'offset' ) ) {
$url = $this->goResult( $term );
if ( $url !== null ) {
// successful 'go'
$session = array();
}
- if ( $request->getVal( 'uselang' ) !== null ) {
+ if ( $request->getCheck( 'uselang' ) ) {
$langCode = $request->getVal( 'uselang' );
} elseif ( isset( $session['settings']['_UserLang'] ) ) {
$langCode = $session['settings']['_UserLang'];