Page MenuHomePhabricator

Special:Block: Cannot read properties of undefined (reading 'value')
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue:

  • Go to Special:Block on any wiki where the Codex interface is enabled.
  • Open the Add block form if it isn't opened yet.
  • Open the developer console.

What happens?

TypeError: Cannot read properties of undefined (reading 'value')
    at setDurationFromGiven (ExpiryField.vue:118:6)
    at watch.immediate (ExpiryField.vue:167:5)
    at tq (vue.js:5:20036)
    at tW (vue.js:5:20104)
    at vue.js:5:54870
    at k (vue.js:5:55842)
    at vue.js:5:56056
    at rX (vue.js:5:56165)
    at vue.js:9:14814
    at setup (ExpiryField.vue:165:3)

The relevant part is:

if ( mw.util.isInfinity( given ) ) {
	expiryType.value = 'preset-duration';
	// Set the "infinite" option that exists.
	presetDuration.value = presetDurationOptions.find(
		( option ) => mw.util.isInfinity( option.value )
	).value; // <--
} // ...

Apparently, the code assumes that there would be an "indefinite" option, but this is no longer true following T401823.

What should have happened instead?

There should have been no errors.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1268274 had a related patch set uploaded (by NguoiDungKhongDinhDanh; author: NguoiDungKhongDinhDanh):

[mediawiki/core@master] Set "indefinite" durations correctly

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

Change #1268274 merged by jenkins-bot:

[mediawiki/core@master] SpecialBlock: Set "indefinite" durations correctly in expiry field

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