ProfessionalWiki / chameleon

Provides a highly flexible and customizable skin using Bootstrap 4
https://www.mediawiki.org/wiki/Skin:Chameleon
Other
116 stars 62 forks source link

Error when Title does not exist #310

Closed JeroenDeDauw closed 2 years ago

JeroenDeDauw commented 2 years ago

Seen at https://maps.extension.wiki/w/index.php?title=404&oldid=285

Happens when the revision exists but the page "does not", for instance when the page is imported but uses an undefined namespace.

MediaWiki internal error.

Original exception: [77e0306a64801d7ede80bf9e] /w/index.php?title=404&oldid=285 Wikimedia\Assert\PostconditionException: Postcondition failed: makeTitleSafe() should always return a Title for the text returned by getRootText().
Backtrace:
from /var/www/html/w/vendor/wikimedia/assert/src/Assert.php(202)
#0 /var/www/html/w/includes/Title.php(2027): Wikimedia\Assert\Assert::postcondition(boolean, string)
#1 /var/www/html/w/includes/skins/Skin.php(518): Title->getRootTitle()
#2 /var/www/html/w/skins/chameleon/src/Chameleon.php(162): Skin->getPageClasses(Title)
#3 /var/www/html/w/includes/OutputPage.php(3147): Skins\Chameleon\Chameleon->getPageClasses(Title)
#4 /var/www/html/w/includes/skins/SkinTemplate.php(437): OutputPage->headElement(Skins\Chameleon\Chameleon)
#5 /var/www/html/w/skins/chameleon/src/Chameleon.php(112): SkinTemplate->prepareQuickTemplate()
#6 /var/www/html/w/includes/skins/SkinTemplate.php(127): Skins\Chameleon\Chameleon->prepareQuickTemplate()
#7 /var/www/html/w/includes/skins/SkinTemplate.php(144): SkinTemplate->generateHTML()
#8 /var/www/html/w/includes/OutputPage.php(2644): SkinTemplate->outputPage()
#9 /var/www/html/w/includes/MediaWiki.php(944): OutputPage->output(boolean)
#10 /var/www/html/w/includes/MediaWiki.php(957): MediaWiki::{closure}()
#11 /var/www/html/w/includes/MediaWiki.php(564): MediaWiki->main()
#12 /var/www/html/w/index.php(53): MediaWiki->run()
#13 /var/www/html/w/index.php(46): wfIndexMain()
#14 {main}
malberts commented 2 years ago

The linked fix is a partial workaround for Chameleon. You will end up losing some HTML body classes, but at least it won't crash the page. However, it seems like an unlikely scenario to be able to open a specific revision ({{index.php?title=Bla:Bla&oldid=2}}) when the page itself won't even let you see the history.

Additionally, this appears to be an upstream issue, because it's reproducible with Vector and Monobook.

Vector:

Original exception: [d5d4a457b26f9043d1171787] /index.php?title=Bla:Bla&oldid=2 Wikimedia\Assert\PostconditionException: Postcondition failed: makeTitleSafe() should always return a Title for the text returned by getRootText().
Backtrace:
from /var/www/html/vendor/wikimedia/assert/src/Assert.php(202)
#0 /var/www/html/includes/Title.php(2027): Wikimedia\Assert\Assert::postcondition(boolean, string)
#1 /var/www/html/includes/skins/Skin.php(518): Title->getRootTitle()
#2 /var/www/html/includes/OutputPage.php(3147): Skin->getPageClasses(Title)
#3 /var/www/html/includes/skins/SkinMustache.php(61): OutputPage->headElement(SkinVector)
#4 /var/www/html/includes/skins/SkinTemplate.php(144): SkinMustache->generateHTML()
#5 /var/www/html/includes/OutputPage.php(2644): SkinTemplate->outputPage()
#6 /var/www/html/includes/MediaWiki.php(944): OutputPage->output(boolean)
#7 /var/www/html/includes/MediaWiki.php(957): MediaWiki::{closure}()
#8 /var/www/html/includes/MediaWiki.php(564): MediaWiki->main()
#9 /var/www/html/index.php(53): MediaWiki->run()
#10 /var/www/html/index.php(46): wfIndexMain()
#11 {main}

Monobook:

Original exception: [acf54760f0cdc57c3430debe] /index.php?title=Bla:Bla&oldid=2 Wikimedia\Assert\PostconditionException: Postcondition failed: makeTitleSafe() should always return a Title for the text returned by getRootText().
Backtrace:
from /var/www/html/vendor/wikimedia/assert/src/Assert.php(202)
#0 /var/www/html/includes/Title.php(2027): Wikimedia\Assert\Assert::postcondition(boolean, string)
#1 /var/www/html/includes/skins/Skin.php(518): Title->getRootTitle()
#2 /var/www/html/includes/OutputPage.php(3147): Skin->getPageClasses(Title)
#3 /var/www/html/includes/skins/SkinMustache.php(61): OutputPage->headElement(SkinMustache)
#4 /var/www/html/includes/skins/SkinTemplate.php(144): SkinMustache->generateHTML()
#5 /var/www/html/includes/OutputPage.php(2644): SkinTemplate->outputPage()
#6 /var/www/html/includes/MediaWiki.php(944): OutputPage->output(boolean)
#7 /var/www/html/includes/MediaWiki.php(957): MediaWiki::{closure}()
#8 /var/www/html/includes/MediaWiki.php(564): MediaWiki->main()
#9 /var/www/html/index.php(53): MediaWiki->run()
#10 /var/www/html/index.php(46): wfIndexMain()
#11 {main}