diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2024-12-19 18:33:17 +0100 |
---|---|---|
committer | Umherirrender <umherirrender_de.wp@web.de> | 2024-12-19 18:33:17 +0100 |
commit | 5d5a81a4b9bf3f3cb110d13abdd9cddfa9b2f462 (patch) | |
tree | d3becdf4def17bca61a0dcaceaac9ccae9ae18f7 | |
parent | 1471c51a0076854148fde8e4dcb37ff8feefecc7 (diff) | |
download | mediawikicore-5d5a81a4b9bf3f3cb110d13abdd9cddfa9b2f462.tar.gz mediawikicore-5d5a81a4b9bf3f3cb110d13abdd9cddfa9b2f462.zip |
Replace isset() with null checks
isset() should only be used to suppress errors, not for null check.
When the property is always defined, there is no need to use isset.
Found by a new phan plugin (2efea9f989)
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset
Change-Id: Ib84b7d71e8308a36409f30ecfd16e9de149e97b3
25 files changed, 62 insertions, 62 deletions
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index d2c3ea5df6f2..e710248dd884 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -2452,7 +2452,7 @@ class ApiMain extends ApiBase { * @return bool */ public function canApiHighLimits() { - if ( !isset( $this->mCanApiHighLimits ) ) { + if ( $this->mCanApiHighLimits === null ) { $this->mCanApiHighLimits = $this->getAuthority()->isAllowed( 'apihighlimits' ); } diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index c3c4fe98de99..e897b893f094 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -90,17 +90,17 @@ class FileRepo { */ protected $transformVia404; - /** @var string URL of image description pages, e.g. + /** @var string|null URL of image description pages, e.g. * https://en.wikipedia.org/wiki/File: */ protected $descBaseUrl; - /** @var string URL of the MediaWiki installation, equivalent to + /** @var string|null URL of the MediaWiki installation, equivalent to * $wgScriptPath, e.g. https://en.wikipedia.org/w */ protected $scriptDirUrl; - /** @var string Equivalent to $wgArticlePath, e.g. https://en.wikipedia.org/wiki/$1 */ + /** @var string|null Equivalent to $wgArticlePath, e.g. https://en.wikipedia.org/wiki/$1 */ protected $articleUrl; /** @var bool Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE], @@ -812,7 +812,7 @@ class FileRepo { * @return string|false False on failure */ public function makeUrl( $query = '', $entry = 'index' ) { - if ( isset( $this->scriptDirUrl ) ) { + if ( $this->scriptDirUrl !== null ) { return wfAppendQuery( "{$this->scriptDirUrl}/{$entry}.php", $query ); } @@ -870,7 +870,7 @@ class FileRepo { if ( $lang !== null ) { $query .= '&uselang=' . urlencode( $lang ); } - if ( isset( $this->scriptDirUrl ) ) { + if ( $this->scriptDirUrl !== null ) { return $this->makeUrl( 'title=' . wfUrlencode( 'Image:' . $name ) . @@ -891,7 +891,7 @@ class FileRepo { * @return string|false False on failure */ public function getDescriptionStylesheetUrl() { - if ( isset( $this->scriptDirUrl ) ) { + if ( $this->scriptDirUrl !== null ) { // Must match canonical query parameter order for optimum caching // See HTMLCacheUpdater::getUrls return $this->makeUrl( 'title=MediaWiki:Filepage.css&action=raw&ctype=text/css' ); @@ -2006,11 +2006,11 @@ class FileRepo { 'descriptionCacheExpiry', ]; foreach ( $optionalSettings as $k ) { - if ( isset( $this->$k ) ) { + if ( $this->$k !== null ) { $ret[$k] = $this->$k; } } - if ( isset( $this->favicon ) ) { + if ( $this->favicon !== null ) { // Expand any local path to full URL to improve API usability (T77093). $ret['favicon'] = MediaWikiServices::getInstance()->getUrlUtils() ->expand( $this->favicon ); diff --git a/includes/filerepo/file/ArchivedFile.php b/includes/filerepo/file/ArchivedFile.php index dfcef8d8bec2..e8f199448110 100644 --- a/includes/filerepo/file/ArchivedFile.php +++ b/includes/filerepo/file/ArchivedFile.php @@ -642,7 +642,7 @@ class ArchivedFile { * @return int|false */ public function pageCount() { - if ( !isset( $this->pageCount ) ) { + if ( $this->pageCount === null ) { // @FIXME: callers expect File objects // @phan-suppress-next-line PhanTypeMismatchArgument if ( $this->getHandler() && $this->handler->isMultiPage( $this ) ) { diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index adffbf482db3..495fecd19d43 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -146,36 +146,36 @@ abstract class File implements MediaHandlerState { /** @var MediaHandler */ protected $handler; - /** @var string The URL corresponding to one of the four basic zones */ + /** @var string|null The URL corresponding to one of the four basic zones */ protected $url; - /** @var string File extension */ + /** @var string|null File extension */ protected $extension; /** @var string|null The name of a file from its title object */ protected $name; - /** @var string The storage path corresponding to one of the zones */ + /** @var string|null The storage path corresponding to one of the zones */ protected $path; /** @var string|null Relative path including trailing slash */ protected $hashPath; - /** @var int|false Number of pages of a multipage document, or false for + /** @var int|false|null Number of pages of a multipage document, or false for * documents which aren't multipage documents */ protected $pageCount; - /** @var string|false URL of transformscript (for example thumb.php) */ + /** @var string|false|null URL of transformscript (for example thumb.php) */ protected $transformScript; /** @var Title */ protected $redirectTitle; - /** @var bool Whether the output of transform() for this file is likely to be valid. */ + /** @var bool|null Whether the output of transform() for this file is likely to be valid. */ protected $canRender; - /** @var bool Whether this media file is in a format that is unlikely to + /** @var bool|null Whether this media file is in a format that is unlikely to * contain viruses or malicious content */ protected $isSafeFile; @@ -360,7 +360,7 @@ abstract class File implements MediaHandlerState { * @return string */ public function getExtension() { - if ( !isset( $this->extension ) ) { + if ( $this->extension === null ) { $n = strrpos( $this->getName(), '.' ); $this->extension = self::normalizeExtension( $n ? substr( $this->getName(), $n + 1 ) : '' ); @@ -398,7 +398,7 @@ abstract class File implements MediaHandlerState { * @return string */ public function getUrl() { - if ( !isset( $this->url ) ) { + if ( $this->url === null ) { $this->assertRepoDefined(); $ext = $this->getExtension(); $this->url = $this->repo->getZoneUrl( 'public', $ext ) . '/' . $this->getUrlRel(); @@ -473,7 +473,7 @@ abstract class File implements MediaHandlerState { * @return string|false ForeignAPIFile::getPath can return false */ public function getPath() { - if ( !isset( $this->path ) ) { + if ( $this->path === null ) { $this->assertRepoDefined(); $this->path = $this->repo->getZonePath( 'public' ) . '/' . $this->getRel(); } @@ -887,7 +887,7 @@ abstract class File implements MediaHandlerState { * @return bool */ public function canRender() { - if ( !isset( $this->canRender ) ) { + if ( $this->canRender === null ) { $this->canRender = $this->getHandler() && $this->handler->canRender( $this ) && $this->exists(); } @@ -940,7 +940,7 @@ abstract class File implements MediaHandlerState { * @return bool */ public function isSafeFile() { - if ( !isset( $this->isSafeFile ) ) { + if ( $this->isSafeFile === null ) { $this->isSafeFile = $this->getIsSafeFileUncached(); } @@ -1051,7 +1051,7 @@ abstract class File implements MediaHandlerState { * @return string|false */ private function getTransformScript() { - if ( !isset( $this->transformScript ) ) { + if ( $this->transformScript === null ) { $this->transformScript = false; if ( $this->repo ) { $script = $this->repo->getThumbScriptUrl(); @@ -2193,7 +2193,7 @@ abstract class File implements MediaHandlerState { * @return int|false */ public function pageCount() { - if ( !isset( $this->pageCount ) ) { + if ( $this->pageCount === null ) { if ( $this->getHandler() && $this->handler->isMultiPage( $this ) ) { $this->pageCount = $this->handler->pageCount( $this ); } else { diff --git a/includes/filerepo/file/OldLocalFile.php b/includes/filerepo/file/OldLocalFile.php index 417c15c61f12..d23818288405 100644 --- a/includes/filerepo/file/OldLocalFile.php +++ b/includes/filerepo/file/OldLocalFile.php @@ -39,7 +39,7 @@ class OldLocalFile extends LocalFile { /** @var string|int Timestamp */ protected $requestedTime; - /** @var string Archive name */ + /** @var string|null Archive name */ protected $archive_name; public const CACHE_VERSION = 1; @@ -185,7 +185,7 @@ class OldLocalFile extends LocalFile { * @return string */ public function getArchiveName() { - if ( !isset( $this->archive_name ) ) { + if ( $this->archive_name === null ) { $this->load(); } diff --git a/includes/filerepo/file/UnregisteredLocalFile.php b/includes/filerepo/file/UnregisteredLocalFile.php index f251708e3f09..34fbe6e162e5 100644 --- a/includes/filerepo/file/UnregisteredLocalFile.php +++ b/includes/filerepo/file/UnregisteredLocalFile.php @@ -43,7 +43,7 @@ class UnregisteredLocalFile extends File { /** @var string */ protected $path; - /** @var string|false */ + /** @var string|false|null */ protected $mime; /** @var array[]|bool[] Dimension data */ @@ -160,7 +160,7 @@ class UnregisteredLocalFile extends File { * @return string|false */ public function getMimeType() { - if ( !isset( $this->mime ) ) { + if ( $this->mime === null ) { $refPath = $this->getLocalRefPath(); if ( $refPath !== false ) { $magic = MediaWikiServices::getInstance()->getMimeAnalyzer(); diff --git a/includes/historyblob/DiffHistoryBlob.php b/includes/historyblob/DiffHistoryBlob.php index b1ce7f443d88..23453dffcd18 100644 --- a/includes/historyblob/DiffHistoryBlob.php +++ b/includes/historyblob/DiffHistoryBlob.php @@ -47,7 +47,7 @@ class DiffHistoryBlob implements HistoryBlob { /** @var array The diff map, see above */ public $mDiffMap; - /** @var string The key for getText() + /** @var string|null The key for getText() */ public $mDefaultKey; @@ -118,7 +118,7 @@ class DiffHistoryBlob implements HistoryBlob { if ( !function_exists( 'xdiff_string_rabdiff' ) ) { throw new RuntimeException( "Need xdiff support to write DiffHistoryBlob\n" ); } - if ( isset( $this->mDiffs ) ) { + if ( $this->mDiffs !== null ) { // Already compressed return; } @@ -306,7 +306,7 @@ class DiffHistoryBlob implements HistoryBlob { 'map' => $map ]; } - if ( isset( $this->mDefaultKey ) ) { + if ( $this->mDefaultKey !== null ) { $info['default'] = $this->mDefaultKey; } $this->mCompressed = gzdeflate( serialize( $info ) ); diff --git a/includes/http/Telemetry.php b/includes/http/Telemetry.php index f4c80b44efa9..ba5db1c6f66e 100644 --- a/includes/http/Telemetry.php +++ b/includes/http/Telemetry.php @@ -76,7 +76,7 @@ class Telemetry implements TelemetryHeadersInterface { */ public function getRequestId(): string { // This method is called from various error handlers and MUST be kept simple and stateless. - if ( !isset( $this->reqId ) ) { + if ( $this->reqId === null ) { if ( $this->allowExternalReqID ) { $id = ( $this->server['HTTP_X_REQUEST_ID'] ?? $this->server['UNIQUE_ID'] ?? wfRandomString( 24 ) ); } else { diff --git a/includes/libs/StatusValue.php b/includes/libs/StatusValue.php index 90d968aecc8c..c4df4dcd26c2 100644 --- a/includes/libs/StatusValue.php +++ b/includes/libs/StatusValue.php @@ -455,7 +455,7 @@ class StatusValue implements Stringable { } else { $errorcount = "no errors detected"; } - if ( isset( $this->value ) ) { + if ( $this->value !== null ) { $valstr = get_debug_type( $this->value ) . " value set"; } else { $valstr = "no value set"; diff --git a/includes/libs/filebackend/FSFileBackend.php b/includes/libs/filebackend/FSFileBackend.php index dcc49db9d146..1d76f2bf9f5e 100644 --- a/includes/libs/filebackend/FSFileBackend.php +++ b/includes/libs/filebackend/FSFileBackend.php @@ -145,7 +145,7 @@ class FSFileBackend extends FileBackendStore { protected function resolveContainerPath( $container, $relStoragePath ) { // Check that container has a root directory - if ( isset( $this->containerPaths[$container] ) || isset( $this->basePath ) ) { + if ( isset( $this->containerPaths[$container] ) || $this->basePath !== null ) { // Check for sensible relative paths (assume the base paths are OK) if ( $this->isLegalRelPath( $relStoragePath ) ) { return $relStoragePath; @@ -184,7 +184,7 @@ class FSFileBackend extends FileBackendStore { protected function containerFSRoot( $shortCont, $fullCont ) { if ( isset( $this->containerPaths[$shortCont] ) ) { return $this->containerPaths[$shortCont]; - } elseif ( isset( $this->basePath ) ) { + } elseif ( $this->basePath !== null ) { return "{$this->basePath}/{$fullCont}"; } diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php index 1354ebb5938b..11ab32b302e4 100644 --- a/includes/libs/rdbms/database/DatabasePostgres.php +++ b/includes/libs/rdbms/database/DatabasePostgres.php @@ -38,7 +38,7 @@ class DatabasePostgres extends Database { private $port; /** @var string */ private $tempSchema; - /** @var float|string */ + /** @var float|string|null */ private $numericVersion; /** @var resource|null */ @@ -777,7 +777,7 @@ __INDEXATTR__; } public function getServerVersion() { - if ( !isset( $this->numericVersion ) ) { + if ( $this->numericVersion === null ) { // Works on PG 7.4+ $this->numericVersion = pg_version( $this->getBindingHandle() )['server']; } diff --git a/includes/logging/DatabaseLogEntry.php b/includes/logging/DatabaseLogEntry.php index 7aa85d7b71f3..a5624727d5e1 100644 --- a/includes/logging/DatabaseLogEntry.php +++ b/includes/logging/DatabaseLogEntry.php @@ -133,7 +133,7 @@ class DatabaseLogEntry extends LogEntryBase { /** @var UserIdentity */ protected $performer; - /** @var array Parameters for log entry */ + /** @var array|null Parameters for log entry */ protected $params; /** @var int A rev id associated to the log entry */ @@ -180,7 +180,7 @@ class DatabaseLogEntry extends LogEntryBase { } public function getParameters() { - if ( !isset( $this->params ) ) { + if ( $this->params === null ) { $blob = $this->getRawParameters(); AtEase::suppressWarnings(); $params = LogEntryBase::extractParams( $blob ); diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index 00ce7ad28b38..f5461c40fc98 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -127,7 +127,7 @@ class LogFormatter { /** * @see LogFormatter::getMessageParameters - * @var array + * @var array|null */ protected $parsedParameters; @@ -659,7 +659,7 @@ class LogFormatter { * @see ManualLogEntry::setParameters() for how parameters are determined. */ protected function getMessageParameters() { - if ( isset( $this->parsedParameters ) ) { + if ( $this->parsedParameters !== null ) { return $this->parsedParameters; } diff --git a/includes/logging/ManualLogEntry.php b/includes/logging/ManualLogEntry.php index bbb355734f52..d0a58f58b650 100644 --- a/includes/logging/ManualLogEntry.php +++ b/includes/logging/ManualLogEntry.php @@ -77,7 +77,7 @@ class ManualLogEntry extends LogEntryBase implements Taggable { /** @var string[] Change tags add to the log entry */ protected $tags = []; - /** @var int Deletion state of the log entry */ + /** @var int|null Deletion state of the log entry */ protected $deleted; /** @var int ID of the log entry */ @@ -321,7 +321,7 @@ class ManualLogEntry extends LogEntryBase implements Taggable { 'log_page' => $this->getTarget()->getArticleID(), 'log_params' => LogEntryBase::makeParamBlob( $params ), ]; - if ( isset( $this->deleted ) ) { + if ( $this->deleted !== null ) { $row['log_deleted'] = $this->deleted; } $row += $services->getCommentStore()->insert( $dbw, 'log_comment', $comment ); diff --git a/includes/pager/AlphabeticPager.php b/includes/pager/AlphabeticPager.php index 336f5bcf1773..961fe45549d9 100644 --- a/includes/pager/AlphabeticPager.php +++ b/includes/pager/AlphabeticPager.php @@ -37,7 +37,7 @@ abstract class AlphabeticPager extends IndexPager { return ''; } - if ( isset( $this->mNavigationBar ) ) { + if ( $this->mNavigationBar !== null ) { return $this->mNavigationBar; } diff --git a/includes/pager/IndexPager.php b/includes/pager/IndexPager.php index 2ab89214e3de..7badce4f1f74 100644 --- a/includes/pager/IndexPager.php +++ b/includes/pager/IndexPager.php @@ -134,7 +134,7 @@ abstract class IndexPager extends ContextSource implements Pager { * * Like $mIndexField, $mDefaultDirection will be a single value even if the * class supports multiple default directions for different order types. - * @var bool + * @var bool|null */ public $mDefaultDirection; /** @var bool */ @@ -151,9 +151,9 @@ abstract class IndexPager extends ContextSource implements Pager { protected $mFirstShown; /** @var array */ protected $mPastTheEndIndex; - /** @var array */ + /** @var array|null */ protected $mDefaultQuery; - /** @var string */ + /** @var string|null */ protected $mNavigationBar; /** @@ -237,7 +237,7 @@ abstract class IndexPager extends ContextSource implements Pager { } } - if ( !isset( $this->mDefaultDirection ) ) { + if ( $this->mDefaultDirection === null ) { $dir = $this->getDefaultDirections(); $this->mDefaultDirection = is_array( $dir ) ? $dir[$this->mOrderType] @@ -723,7 +723,7 @@ abstract class IndexPager extends ContextSource implements Pager { * @return array Associative array */ public function getDefaultQuery() { - if ( !isset( $this->mDefaultQuery ) ) { + if ( $this->mDefaultQuery === null ) { $this->mDefaultQuery = $this->getRequest()->getQueryValues(); unset( $this->mDefaultQuery['title'] ); unset( $this->mDefaultQuery['dir'] ); diff --git a/includes/pager/ReverseChronologicalPager.php b/includes/pager/ReverseChronologicalPager.php index e00fcf382c75..5201cd9d874d 100644 --- a/includes/pager/ReverseChronologicalPager.php +++ b/includes/pager/ReverseChronologicalPager.php @@ -173,7 +173,7 @@ abstract class ReverseChronologicalPager extends IndexPager { return ''; } - if ( isset( $this->mNavigationBar ) ) { + if ( $this->mNavigationBar !== null ) { return $this->mNavigationBar; } diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 9143d969cc2c..b720a7529c13 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -1015,7 +1015,7 @@ class ParserOptions { * @return string TS_MW timestamp */ public function getTimestamp() { - if ( !isset( $this->mTimestamp ) ) { + if ( $this->mTimestamp === null ) { $this->mTimestamp = wfTimestampNow(); } return $this->mTimestamp; diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index afc5339fc5e9..efad96514454 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -711,7 +711,7 @@ class Preprocessor_Hash extends Preprocessor { $children[] = $titleNode; $argIndex = 1; foreach ( $parts as $part ) { - if ( isset( $part->eqpos ) ) { + if ( $part->eqpos !== null ) { $equalsNode = $part->out[$part->eqpos]; $nameNode = [ 'name', array_slice( $part->out, 0, $part->eqpos ) ]; $valueNode = [ 'value', array_slice( $part->out, $part->eqpos + 1 ) ]; diff --git a/includes/password/Pbkdf2PasswordUsingOpenSSL.php b/includes/password/Pbkdf2PasswordUsingOpenSSL.php index 5125294fd773..f6abb1f93036 100644 --- a/includes/password/Pbkdf2PasswordUsingOpenSSL.php +++ b/includes/password/Pbkdf2PasswordUsingOpenSSL.php @@ -31,7 +31,7 @@ namespace MediaWiki\Password; */ class Pbkdf2PasswordUsingOpenSSL extends AbstractPbkdf2Password { /** - * @var array<string, string> + * @var array<string,string>|null */ private static $digestAlgos; @@ -57,7 +57,7 @@ class Pbkdf2PasswordUsingOpenSSL extends AbstractPbkdf2Password { ]; protected function getDigestAlgo( string $algo ): ?string { - if ( !isset( self::$digestAlgos ) ) { + if ( self::$digestAlgos === null ) { self::$digestAlgos = array_intersect( self::DIGEST_ALGOS, openssl_get_md_methods() ); } return self::$digestAlgos[$algo] ?? null; diff --git a/includes/recentchanges/ChangesListFilterGroup.php b/includes/recentchanges/ChangesListFilterGroup.php index 7ca55c273e89..1ddba5db9885 100644 --- a/includes/recentchanges/ChangesListFilterGroup.php +++ b/includes/recentchanges/ChangesListFilterGroup.php @@ -339,7 +339,7 @@ abstract class ChangesListFilterGroup { 'messageKeys' => [ $this->title ] ]; - if ( isset( $this->whatsThisHeader ) ) { + if ( $this->whatsThisHeader !== null ) { $output['whatsThisHeader'] = $this->whatsThisHeader; $output['whatsThisBody'] = $this->whatsThisBody; $output['whatsThisUrl'] = $this->whatsThisUrl; diff --git a/includes/search/RevisionSearchResultTrait.php b/includes/search/RevisionSearchResultTrait.php index 59d03891c31f..6739b7239768 100644 --- a/includes/search/RevisionSearchResultTrait.php +++ b/includes/search/RevisionSearchResultTrait.php @@ -31,7 +31,7 @@ trait RevisionSearchResultTrait { protected $mTitle; /** - * @var string + * @var string|null */ protected $mText; @@ -96,7 +96,7 @@ trait RevisionSearchResultTrait { * Lazy initialization of article text from DB */ protected function initText() { - if ( !isset( $this->mText ) ) { + if ( $this->mText === null ) { if ( $this->mRevisionRecord != null ) { $content = $this->mRevisionRecord->getContent( SlotRecord::MAIN ); $this->mText = $content !== null ? $content->getTextForSearchIndex() : ''; diff --git a/includes/specialpage/SpecialPage.php b/includes/specialpage/SpecialPage.php index e3f64e6b07ac..83b9994790ff 100644 --- a/includes/specialpage/SpecialPage.php +++ b/includes/specialpage/SpecialPage.php @@ -295,7 +295,7 @@ class SpecialPage implements MessageLocalizer { * @return string */ public function getLocalName() { - if ( !isset( $this->mLocalName ) ) { + if ( $this->mLocalName === null ) { $this->mLocalName = $this->getSpecialPageFactory()->getLocalNameFor( $this->mName ); } diff --git a/includes/specials/SpecialUserLogout.php b/includes/specials/SpecialUserLogout.php index d67b0e60d775..0988397324f9 100644 --- a/includes/specials/SpecialUserLogout.php +++ b/includes/specials/SpecialUserLogout.php @@ -36,7 +36,7 @@ use MediaWiki\User\TempUser\TempUserConfig; */ class SpecialUserLogout extends FormSpecialPage { /** - * @var string + * @var string|null */ private $oldUserName; @@ -132,7 +132,7 @@ class SpecialUserLogout extends FormSpecialPage { $messageKey = 'logouttext'; if ( - ( isset( $this->oldUserName ) && $this->tempUserConfig->isTempName( $this->oldUserName ) ) || + ( $this->oldUserName !== null && $this->tempUserConfig->isTempName( $this->oldUserName ) ) || $this->getRequest()->getCheck( 'wasTempUser' ) ) { // Generates the message key logouttext-for-temporary-account which is used to customise the success @@ -156,7 +156,7 @@ class SpecialUserLogout extends FormSpecialPage { // Set the page title as "templogout" if the user is (or just was) logged in to a temporary account if ( $this->getUser()->isTemp() || - ( isset( $this->oldUserName ) && $this->tempUserConfig->isTempName( $this->oldUserName ) ) || + ( $this->oldUserName !== null && $this->tempUserConfig->isTempName( $this->oldUserName ) ) || $this->getRequest()->getCheck( 'wasTempUser' ) ) { return $this->msg( 'templogout' ); diff --git a/includes/upload/UploadStashFile.php b/includes/upload/UploadStashFile.php index c861ea829196..b07b2427b9df 100644 --- a/includes/upload/UploadStashFile.php +++ b/includes/upload/UploadStashFile.php @@ -186,7 +186,7 @@ class UploadStashFile extends UnregisteredLocalFile { * @return string Url */ public function getUrl() { - if ( !isset( $this->url ) ) { + if ( $this->url === null ) { $this->url = $this->getSpecialUrl( 'file/' . $this->getUrlName() ); } |