Page MenuHomePhabricator

InputBox and substituted transclusion causes exception Call to a member function getActorId() on bool
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):
Pasting original explanation by Raidarr in https://phabricator.miraheze.org/T8559 due to the complexity:
"On Qualitipedia central, I tried an experiment to circumvent a blog extension's blog creation page because there was no apparent way to turn off date generation. I decided to make a new page that would a) not do this and b) consider doing a little extra, but I got as far as an input box on this now-deleted page (can be restored in full if needed). I ambitiously cobbled together thoughts based on Meta's substituted preloads for adoption requests using MediaWiki's InputBox extension guide for various inputs. I didn't expect it all to work, but I expected it to run and to adjust as needed.

The original trial infobox was this:

 <inputbox>
type=create
width=72
summary=New blog post created
editintro=This description is a test. '''Hello.''' Good luck.
prefix=Blog:
buttonlabel:Create blog
break=no
preload=Q:CBP/P
</inputbox>

That produced this broken page.

Not learning my lesson I decided to trim a few inputs and make this.

 <inputbox>
type=create
width=72
summary=New blog post created
prefix=Blog:
break=no
preload=Q:CBP/P
</inputbox>

Then producing this broken page.

At that point I made note of it on discord and deleted the primary page leading to here.

Associated pages are Part 1 Part 2 as standard components in a blog post for top and bottom and the Preload to glue them with blog text input in between the first two. Page editing is fine, even perfect; page posting results in the above. Shortlinks achieved by having Q redirect to the Qualitipedia namespace. I probably tried too many inefficient experimental things at once."

What happens?:

Call to a member function getActorId() on bool
from /srv/mediawiki/w/extensions/BlogPage/includes/BlogPage.class.php(210)
#0 /srv/mediawiki/w/extensions/BlogPage/includes/BlogPage.class.php(28): BlogPage->getAuthors()
#1 /srv/mediawiki/w/extensions/BlogPage/includes/BlogPage.hooks.php(31): BlogPage->__construct(Title)
#2 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(338): BlogPageHooks::blogFromTitle(Title, NULL, RequestContext)
#3 /srv/mediawiki/w/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#4 /srv/mediawiki/w/includes/HookContainer/HookRunner.php(734): MediaWiki\HookContainer\HookContainer->run(string, array)
#5 /srv/mediawiki/w/includes/page/Article.php(170): MediaWiki\HookContainer\HookRunner->onArticleFromTitle(Title, NULL, RequestContext)
#6 /srv/mediawiki/w/includes/page/Article.php(196): Article::newFromTitle(Title, RequestContext)
#7 /srv/mediawiki/w/includes/actions/ActionFactory.php(385): Article::newFromWikiPage(WikiPage, RequestContext)
#8 /srv/mediawiki/w/includes/actions/ActionFactory.php(350): MediaWiki\Actions\ActionFactory->getArticle(RequestContext)
#9 /srv/mediawiki/w/includes/actions/Action.php(111): MediaWiki\Actions\ActionFactory->getActionName(RequestContext)
#10 /srv/mediawiki/w/includes/MediaWiki.php(176): Action::getActionName(RequestContext)
#11 /srv/mediawiki/w/includes/MediaWiki.php(892): MediaWiki->getAction()
#12 /srv/mediawiki/w/includes/MediaWiki.php(564): MediaWiki->main()
#13 /srv/mediawiki/w/index.php(53): MediaWiki->run()
#14 /srv/mediawiki/w/index.php(46): wfIndexMain()
#15 {main}

What should have happened instead?:
The page should work normally

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
MediaWiki 1.37.1 (b57ada3)
PHP 7.4.25 (fpm-fcgi)
MariaDB 10.5.13-MariaDB-1:10.5.13+maria~bullseye-log

Event Timeline

Restricted Application added subscribers: RhinosF1, Universal_Omega, Aklapper. · View Herald Transcript

As also mentioned in the Miraheze task:

The actual problem seems to be that the custom blog page creation system doesn't subst {{REVISIONUSER}} (that is, https://qualitipedia.miraheze.org/w/index.php?title=Qualitipedia:CBP/2&action=edit should say [[Category:Articles by user {{<includeonly>subst:</includeonly>REVISIONUSER}}]] instead of [[Category:Articles by user {{REVISIONUSER}}]]. Once you do that new blogs created using that system should at least not error.

Change 755827 had a related patch set uploaded (by Jack Phoenix; author: Jack Phoenix):

[mediawiki/extensions/BlogPage@master] Optimism never suited anyone

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

I appreciate the detailed report. 👍

Before we get any further, let me address one big issue here:

I tried an experiment to circumvent a blog extension's blog creation page because there was no apparent way to turn off date generation. [--]

Developers are not mind readers. We will gladly try to address issues, provided we know about them. :)
Personally I'd be curious to know about why turning off the category date creation is a feature you want. (In any case, it looks like this is basically T200852: CreateBlog page content layout should be configurable).

Also, as a general note I'm not sure if trying to hack around PHP-level bugs or "bugs" in wikitext is the best possible approach. Sure, it's often the only one available to an end-user, but...

The aforementioned patch should address the immediate issue (PHP fatal error) that this ticket is about. The root cause (BlogPage's parsing code kinda sucks and actually a lot) is definitely not addressed there, nor does it fix (or even claim to fix) T200852.

The "Special:CreateBlogPost does not render fancy wikitext hacks" issue is a separate beast and...I thought I knew what might be causing it but now I'm not so sure anymore. The code wraps the user-submitted input in ContentHandler#makeContent and passes this to WikiPage#doEditContent; I'm not sure about how the parsing is done there; what I do know is that for preview it uses the Parser's preSaveTransform endpoint, which can and will render some things differently than the final output (buuuuut it shooould be identical to a "regular" page preview? hopefully...).

Change 755827 merged by jenkins-bot:

[mediawiki/extensions/BlogPage@master] Optimism never suited anyone

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

ashley claimed this task.

Hopefully addressed by the patch which got merged in February 2022. If not, please reopen and report back with as much details as possible. For now, I'm assuming that this is fixed.