Page MenuHomePhabricator

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in SpecialDiff.php on line 92
Closed, ResolvedPublic

Description

See also: T312300: Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in SpecialDiff.php on line 50

( ! ) Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/wiki/mediawiki/core/includes/specials/SpecialDiff.php on line 92
Call Stack
#	Time	Memory	Function	Location
1	0.0001	361832	{main}( )	.../index.php:0
2	0.0618	3581256	wfIndexMain( )	.../index.php:46
3	0.0618	3581368	MediaWiki->run( )	.../index.php:50
4	0.0618	3581368	MediaWiki->main( )	.../MediaWiki.php:569
5	0.0624	3595376	MediaWiki->performRequest( )	.../MediaWiki.php:913
6	0.0675	3720928	MediaWiki\SpecialPage\SpecialPageFactory->executePath( $path = class Title { private $mTextform = 'Diff'; private $mUrlform = 'Diff'; private $mDbkeyform = 'Diff'; private $mNamespace = -1; private $mInterwiki = ''; private $mLocalInterwiki = FALSE; private $mFragment = ''; public $mArticleID = 0; protected $mLatestID = FALSE; private $mContentModel = FALSE; private $mForcedContentModel = FALSE; private $mEstimateRevisions = NULL; public $prefixedText = NULL; protected $mLength = -1; public $mRedirect = NULL; private $mHasSubpages = NULL; private $mPageLanguage = NULL; private $mDbPageLanguage = FALSE; private $mTitleValue = NULL; private $mIsBigDeletion = NULL; private $mIsValid = TRUE; private $mInstanceCacheKey = NULL; protected $deprecatedPublicProperties = ['mTextform' => [...], 'mUrlform' => [...], 'mDbkeyform' => [...], 'mNamespace' => [...], 'mInterwiki' => [...], 'mFragment' => [...]]; private $dynamicPropertiesAccessDeprecated = FALSE }, $context = class RequestContext { private $request = class WebRequest { protected $data = [...]; protected $queryAndPathParams = [...]; protected $queryParams = [...]; protected $headers = [...]; private $response = class WebResponse { ... }; private $ip = '10.13.37.22'; protected $requestTime = 1657142911.7463; protected $protocol = 'http'; protected $sessionId = class MediaWiki\Session\SessionId { ... }; protected $markedAsSafe = FALSE }; private $title = class Title { private $mTextform = 'Diff'; private $mUrlform = 'Diff'; private $mDbkeyform = 'Diff'; private $mNamespace = -1; private $mInterwiki = ''; private $mLocalInterwiki = FALSE; private $mFragment = ''; public $mArticleID = 0; protected $mLatestID = FALSE; private $mContentModel = FALSE; private $mForcedContentModel = FALSE; private $mEstimateRevisions = NULL; public $prefixedText = 'Special:Diff'; protected $mLength = -1; public $mRedirect = NULL; private $mHasSubpages = NULL; private $mPageLanguage = NULL; private $mDbPageLanguage = FALSE; private $mTitleValue = NULL; private $mIsBigDeletion = NULL; private $mIsValid = NULL; private $mInstanceCacheKey = NULL; protected $deprecatedPublicProperties = [...]; private $dynamicPropertiesAccessDeprecated = FALSE }; private $wikipage = NULL; private $action = NULL; private $output = class OutputPage { private ${ContextSource}context = ...; protected $mMetatags = [...]; protected $mLinktags = [...]; protected $mCanonicalUrl = FALSE; private $mPageTitle = 'Differences'; private $displayTitle = NULL; private $cacheIsFinal = FALSE; public $mBodytext = ''; private $mHTMLtitle = 'Differences - ReedyDevWiki'; private $mIsArticle = FALSE; private $mIsArticleRelated = FALSE; private $mHasCopyright = FALSE; private $mPrintable = FALSE; private $mSections = [...]; private $mSubtitle = [...]; public $mRedirect = ''; protected $mStatusCode = NULL; protected $mLastModified = ''; protected $mCategoryLinks = [...]; protected $mCategories = [...]; protected $mIndicators = [...]; private $mLanguageLinks = [...]; private $mScripts = ''; protected $mInlineStyles = ''; public $mPageLinkTitle = ''; protected $mAdditionalHtmlClasses = [...]; protected $mHeadItems = [...]; protected $mAdditionalBodyClasses = [...]; protected $mModules = [...]; protected $mModuleStyles = [...]; protected $mResourceLoader = NULL; private $rlClient = NULL; private $rlClientContext = NULL; private $rlExemptStyleModules = NULL; protected $mJsConfigVars = [...]; protected $mTemplateIds = [...]; protected $mImageTimeKeys = [...]; public $mRedirectCode = ''; protected $mFeedLinksAppendQuery = NULL; protected $mAllowedModules = [...]; protected $mDoNothing = FALSE; protected $mParserOptions = NULL; private $mFeedLinks = [...]; protected $mEnableClientCache = TRUE; private $mArticleBodyOnly = FALSE; protected $mNewSectionLink = FALSE; protected $mHideNewSectionLink = FALSE; public $mNoGallery = FALSE; protected $mCdnMaxage = 0; protected $mCdnMaxageLimit = INF; protected $mPreventClickjacking = TRUE; private $mRevisionId = NULL; private $mRevisionTimestamp = NULL; protected $mFileVersion = NULL; protected $styles = [...]; private $mIndexPolicy = 'noindex'; private $mFollowPolicy = 'nofollow'; private $mRobotsOptions = [...]; private $mVaryHeader = [...]; private $mRedirectedFrom = NULL; private $mProperties = [...]; private $mTarget = NULL; private $mEnableTOC = FALSE; private $copyrightUrl = NULL; private $limitReportJSData = [...]; private $contentOverrides = [...]; private $contentOverrideCallbacks = [...]; private $mLinkHeader = [...]; private $CSP = class ContentSecurityPolicy { ... } }; private $user = class User { public $mId = 0; public $mName = FALSE; public $mActorId = NULL; public $mRealName = ''; public $mEmail = ''; public $mTouched = '1'; protected $mQuickTouched = NULL; protected $mToken = NULL; public $mEmailAuthenticated = NULL; protected $mEmailToken = ''; protected $mEmailTokenExpires = NULL; protected $mRegistration = '20220706212831'; protected $mLoadedItems = TRUE; public $mFrom = 'session'; protected $mDatePreference = NULL; private $mBlockedby = -1; protected $mHash = FALSE; protected $mBlockreason = NULL; protected $mGlobalBlock = NULL; protected $mLocked = NULL; private $mHideName = NULL; private $mRequest = class WebRequest { ... }; private $mBlock = NULL; private $mBlockedFromCreateAccount = FALSE; protected $queryFlagsUsed = 0; private $mThisAsAuthority = class MediaWiki\Permissions\UserAuthority { ... }; private $isTemp = NULL }; private $authority = NULL; private $lang = class Language { public $mCode = 'en-gb'; public $mMagicExtensions = [...]; private $mHtmlCode = NULL; public $dateFormatStrings = [...]; public $mExtendedSpecialPageAliases = [...]; protected $namespaceNames = [...]; protected $mNamespaceIds = NULL; protected $namespaceAliases = NULL; private $transformData = [...]; private $namespaceInfo = class NamespaceInfo { ... }; private $localisationCache = class LocalisationCache { ... }; private $langNameUtils = class MediaWiki\Languages\LanguageNameUtils { ... }; private $langFallback = class MediaWiki\Languages\LanguageFallback { ... }; private $grammarTransformCache = NULL; private $converterFactory = class MediaWiki\Languages\LanguageConverterFactory { ... }; private $hookContainer = class MediaWiki\HookContainer\HookContainer { ... }; private $hookRunner = class MediaWiki\HookContainer\HookRunner { ... }; private $config = class GlobalVarConfig { ... } }; private $skin = class MediaWiki\Skins\Vector\SkinVectorLegacy { private ${ContextSource}context = ...; private ${Skin}defaultLinkOptions = [...]; protected $skinname = 'vector'; protected $options = [...]; protected $mRelevantTitle = NULL; private ${Skin}mRelevantUser = FALSE; private ${Skin}languageLinks = NULL; private ${Skin}sidebar = NULL; private ${Skin}componentRegistry = class MediaWiki\Skin\SkinComponentRegistry { ... }; public $template = NULL; public $thispage = NULL; public $titletxt = NULL; public $userpage = NULL; public $thisquery = NULL; public $loggedin = NULL; public $username = NULL; public $userpageUrlDetails = NULL; private ${SkinTemplate}isTempUser = NULL; private ${SkinTemplate}isNamedUser = NULL; private ${SkinTemplate}templateContextSet = FALSE; private ${SkinTemplate}contentNavigationCached = NULL; private ${SkinMustache}templateParser = NULL; private ${MediaWiki\Skins\Vector\SkinVector}languages = NULL }; private $timing = NULL; private $config = class GlobalVarConfig { private $prefix = 'wg' }; private $languageRecursion = FALSE }, $including = ???, $linkRenderer = ??? )	.../MediaWiki.php:316
7	0.0676	3724824	SpecialPage->run( $subPage = NULL )	.../SpecialPageFactory.php:1421
8	0.0688	3770184	RedirectSpecialPage->execute( $subpage = NULL )	.../SpecialPage.php:691
9	0.0731	3800440	SpecialDiff->showNoRedirectPage( )	.../RedirectSpecialPage.php:55
10	0.1010	5250520	SpecialDiff->showForm( )	.../SpecialDiff.php:69
11	0.1141	5419816	HTMLForm->show( )	.../SpecialDiff.php:104
12	0.1141	5420256	HTMLForm->displayForm( $submitResult = FALSE )	.../HTMLForm.php:636
13	0.1142	5420256	HTMLForm->getHTML( $submitResult = FALSE )	.../HTMLForm.php:1236
14	0.1142	5420840	OOUIHTMLForm->getBody( )	.../HTMLForm.php:1284
15	0.1142	5420840	HTMLForm->getBody( )	.../OOUIHTMLForm.php:283
16	0.1142	5420840	HTMLForm->displaySection( $fields = ['oldid' => class HTMLIntField { public $mParams = [...]; protected $mValidationCallback = NULL; protected $mFilterCallback = NULL; protected $mName = 'oldid'; protected $mDir = NULL; protected $mLabel = 'Old revision ID (optional)'; protected $mID = 'mw-input-oldid'; protected $mClass = ''; protected $mVFormClass = ''; protected $mHelpClass = FALSE; protected $mDefault = NULL; protected $mOptions = FALSE; protected $mOptionsLabelsNotFromMessage = FALSE; protected $mCondState = [...]; protected $mCondStateClass = [...]; protected $mShowEmptyLabels = FALSE; public $mParent = class OOUIHTMLForm { ... }; protected $mPlaceholder = ''; protected $autocomplete = NULL }, 'diff' => class HTMLSelectOrOtherField { public $mParams = [...]; protected $mValidationCallback = class Closure { virtual $closure = "$this->{closure}", ... }; protected $mFilterCallback = NULL; protected $mName = 'diff'; protected $mDir = NULL; protected $mLabel = 'Revision ID of difference'; protected $mID = 'mw-input-diff'; protected $mClass = ''; protected $mVFormClass = ''; protected $mHelpClass = FALSE; protected $mDefault = NULL; protected $mOptions = [...]; protected $mOptionsLabelsNotFromMessage = FALSE; protected $mCondState = [...]; protected $mCondStateClass = [...]; protected $mShowEmptyLabels = FALSE; public $mParent = class OOUIHTMLForm { ... }; protected $mPlaceholder = ''; protected $autocomplete = NULL }], $sectionName = '', $fieldsetIDPrefix = ???, $hasUserVisibleFields = ??? )	.../HTMLForm.php:1502
17	0.1213	5522160	HTMLFormField->getOOUI( $value = NULL )	.../HTMLForm.php:1931
18	0.1222	5542832	HTMLFormField->getErrorsRaw( $value = NULL )	.../HTMLFormField.php:714
19	0.1222	5542832	HTMLFormField->validate( $value = NULL, $alldata = ['oldid' => NULL, 'diff' => NULL] )	.../HTMLFormField.php:1025
20	0.1222	5542832	SpecialDiff->{closure:/var/www/wiki/mediawiki/core/includes/specials/SpecialDiff.php:91-99}( $value = NULL, ['oldid' => NULL, 'diff' => NULL], class OOUIHTMLForm { private ${ContextSource}context = class RequestContext { private $request = class WebRequest { ... }; private $title = class Title { ... }; private $wikipage = NULL; private $action = NULL; private $output = class OutputPage { ... }; private $user = class User { ... }; private $authority = NULL; private $lang = class Language { ... }; private $skin = class MediaWiki\Skins\Vector\SkinVectorLegacy { ... }; private $timing = NULL; private $config = class GlobalVarConfig { ... }; private $languageRecursion = FALSE }; public $mFieldData = ['oldid' => NULL, 'diff' => NULL]; protected $mMessagePrefix = 'diff-form'; protected $mFlatFields = ['oldid' => class HTMLIntField { ... }, 'diff' => class HTMLSelectOrOtherField { ... }]; protected $mFieldTree = ['oldid' => class HTMLIntField { ... }, 'diff' => class HTMLSelectOrOtherField { ... }]; protected $mShowReset = FALSE; protected $mShowSubmit = TRUE; protected $mSubmitFlags = [0 => 'primary', 1 => 'progressive']; protected $mShowCancel = FALSE; protected $mCancelTarget = NULL; protected $mSubmitCallback = [0 => class SpecialDiff { ... }, 1 => 'onFormSubmit']; protected $mValidationErrorMessage = NULL; protected $mPre = ''; protected $mHeader = ''; protected $mFooter = ''; protected $mSectionHeaders = []; protected $mSectionFooters = []; protected $mPost = ''; protected $mId = NULL; protected $mName = NULL; protected $mTableId = ''; protected $mSubmitID = NULL; protected $mSubmitName = NULL; protected $mSubmitText = 'Show differences'; protected $mSubmitTooltip = NULL; protected $mFormIdentifier = NULL; protected $mTitle = NULL; protected $mMethod = 'post'; protected $mWasSubmitted = FALSE; protected $mAction = FALSE; protected $mCollapsible = FALSE; protected $mCollapsed = FALSE; protected $mAutocomplete = NULL; protected $mUseMultipart = FALSE; protected $mHiddenFields = []; protected $mButtons = []; protected $mWrapperLegend = FALSE; protected $mWrapperAttributes = []; protected $mTokenSalt = ''; protected $mSubSectionBeforeFields = TRUE; protected $displayFormat = 'ooui'; protected $availableDisplayFormats = [0 => 'table', 1 => 'div', 2 => 'raw', 3 => 'inline']; protected $availableSubclassDisplayFormats = [0 => 'vform', 1 => 'ooui']; private ${HTMLForm}hiddenTitleAddedToForm = TRUE; private $oouiErrors = []; private $oouiWarnings = [] } )	.../HTMLFormField.php:410
21	0.1222	5542832	trim( $string = NULL )	.../SpecialDiff.php:92

Event Timeline

Question is what we want to do if $value is null:

				// Remove validation callback when using int type - T256425
				'validation-callback' => function ( $value ) {
					$value = trim( $value );
					if ( preg_match( '/^\d*$/', $value )
						|| in_array( $value, [ 'prev', 'cur', 'next' ], true )
					) {
						return true;
					}
					return $this->msg( 'diff-form-error-revid' );
				},

Change 813709 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] SpecialDiff: Don't pass null to trim()

https://gerrit.wikimedia.org/r/813709

Change 813709 merged by jenkins-bot:

[mediawiki/core@master] SpecialDiff: Don't pass null to trim()

https://gerrit.wikimedia.org/r/813709

Change 813674 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@REL1_38] SpecialDiff: Don't pass null to trim()

https://gerrit.wikimedia.org/r/813674

Change 813675 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@REL1_37] SpecialDiff: Don't pass null to trim()

https://gerrit.wikimedia.org/r/813675

Change 813676 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@REL1_35] SpecialDiff: Don't pass null to trim()

https://gerrit.wikimedia.org/r/813676

Change 813676 merged by jenkins-bot:

[mediawiki/core@REL1_35] SpecialDiff: Don't pass null to trim()

https://gerrit.wikimedia.org/r/813676

Change 813675 merged by jenkins-bot:

[mediawiki/core@REL1_37] SpecialDiff: Don't pass null to trim()

https://gerrit.wikimedia.org/r/813675

Change 813674 merged by jenkins-bot:

[mediawiki/core@REL1_38] SpecialDiff: Don't pass null to trim()

https://gerrit.wikimedia.org/r/813674

Zabe claimed this task.