Page MenuHomePhabricator

"Empty input for field page_title" on Special:MultiPageEdit
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Go to Special:MultiPageEdit on MediaWiki 1.39 or 1.40.

What happens?:
Page returns an MWException with the following error and stack trace:

Wikimedia\Rdbms\Platform\SQLPlatform::makeList: empty input for field page_title
from /srv/mediawiki/w/includes/libs/rdbms/platform/SQLPlatform.php(234)
#0 /srv/mediawiki/w/includes/libs/rdbms/platform/SQLPlatform.php(722): Wikimedia\Rdbms\Platform\SQLPlatform->makeList(array, integer)
#1 /srv/mediawiki/w/includes/libs/rdbms/database/Database.php(3628): Wikimedia\Rdbms\Platform\SQLPlatform->selectSQLText(array, array, array, string, array, array)
#2 /srv/mediawiki/w/includes/libs/rdbms/database/DatabaseMysqlBase.php(760): Wikimedia\Rdbms\Database->selectSQLText(array, array, array, string, array, array)
#3 /srv/mediawiki/w/includes/libs/rdbms/database/Database.php(1622): Wikimedia\Rdbms\DatabaseMysqlBase->selectSQLText(array, array, array, string, array, array)
#4 /srv/mediawiki/w/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#5 /srv/mediawiki/w/includes/libs/rdbms/database/DBConnRef.php(344): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6 /srv/mediawiki/w/includes/specialpage/QueryPage.php(543): Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#7 /srv/mediawiki/w/includes/specialpage/QueryPage.php(729): QueryPage->reallyDoQuery(integer, integer)
#8 /srv/mediawiki/w/extensions/PageForms/specials/PF_MultiPageEdit.php(48): QueryPage->execute(NULL)
#9 /srv/mediawiki/w/includes/specialpage/SpecialPage.php(701): PFMultiPageEdit->execute(NULL)
#10 /srv/mediawiki/w/includes/specialpage/SpecialPageFactory.php(1475): SpecialPage->run(NULL)
#11 /srv/mediawiki/w/includes/MediaWiki.php(327): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#12 /srv/mediawiki/w/includes/MediaWiki.php(923): MediaWiki->performRequest()
#13 /srv/mediawiki/w/includes/MediaWiki.php(576): MediaWiki->main()
#14 /srv/mediawiki/w/index.php(50): MediaWiki->run()
#15 /srv/mediawiki/w/index.php(46): wfIndexMain()
#16 {main}

What should have happened instead?:
Special:MultiPageEdit should load fine.

Software version: MediaWiki 1.39 and MediaWiki 1.40, both running the latest version available of PageForms

Event Timeline

How odd... there may be something wrong with your database. The code that is failing is getting the values for the field page_title from the DB table page, where the field page_namespace is equal to NS_TEMPLATE (i.e. 10). It seems like for at least one of these rows, page_title is blank (though it shouldn't be). Is that possible?

I have the same or a very similar issue.

The makeList function is getting this as the conds array:
array(2) {

["page_namespace"]=>
int(10)
["page_title"]=>
array(0) {
}

}

The SQL it generates (with the error suppressed)
SELECT page_title AS title,page_title AS value FROM curr_page WHERE page_namespace = 10 AND page_title = '' ORDER BY value LIMIT 51

This function in reallyDoQuery returns the page_title as an array, but it seems that it needs to be returned as a string (and not a blank string):
$query = $this->getQueryInfo();

I can access the Special:MultiPageEdit if I specify the form and template in the URL, but it returns a page with no results.

@Tr00j00 - what versions of MediaWiki and Page Forms are you running?

I am using:

Mediawiki 1.37
Page Forms 5.4
SemanticMediaWiki 4.0.1

@Tr00j00 For the records, MediaWiki 1.37 has been unsupported for seven months and is now insecure. Please upgrade for your own safety.

Well, you should indeed upgrade MediaWiki at some point, but more relevant to this issue is that you should upgrade Page Forms - there's a chance that whatever bug you are seeing now has been fixed already. Ideally, of course, you should upgrade both.

I am running 1.39 with PageForms 5.6.1 + custom PHP8 fixes (see corresponding issues) and am getting the same error.
To make it clear: I'm getting the same issue as OP, with MW 1.39 and current PF, not the outdated version of Tr00j00

Investigating: I suspected this was a PHP8 related error. It is not PHP8 related; I get the same error with PHP7.4.

MariaDB [msf_wiki]> select * from page where page_namespace = 10;
+---------+----------------+----------------------+------------------+-------------+----------------+----------------+--------------------+-------------+----------+--------------------+-----------+
| page_id | page_namespace | page_title           | page_is_redirect | page_is_new | page_random    | page_touched   | page_links_updated | page_latest | page_len | page_content_model | page_lang |
+---------+----------------+----------------------+------------------+-------------+----------------+----------------+--------------------+-------------+----------+--------------------+-----------+
|      45 |             10 | InstituteUser        |                0 |           1 | 0.309973464023 | 20230803120913 | 20230803121242     |          91 |      686 | wikitext           | NULL      |
|      52 |             10 | Instrument           |                0 |           0 | 0.818876936406 | 20230803155950 | 20230803155950     |         124 |      832 | wikitext           | NULL      |
|      27 |             10 | Ivmbox               |                1 |           1 | 0.348150561974 | 20230721153115 | 20230721120120     |          34 |       39 | wikitext           | NULL      |
|      26 |             10 | Ivory_messagebox     |                0 |           0 | 0.092648723854 | 20230721122149 | 20230721122149     |          43 |      701 | wikitext           | NULL      |
|      29 |             10 | Ivory_messagebox/doc |                0 |           0 | 0.682466344502 | 20230726153124 | 20230721123413     |          40 |     2683 | wikitext           | NULL      |
|      13 |             10 | Landscape            |                0 |           1 | 0.903200530482 | 20230721120455 | 20230720112414     |          13 |       45 | wikitext           | NULL      |
|      14 |             10 | Landscape/styles.css |                0 |           1 | 0.109863493531 | 20230720100038 | 20230720100038     |          14 |       37 | sanitized-css      | NULL      |
|      21 |             10 | Mbox                 |                0 |           1 | 0.862946419512 | 20230726061456 | 20230721120540     |          28 |      136 | wikitext           | NULL      |
|      17 |             10 | Transcluded          |                0 |           0 | 0.517391997538 | 20230721124415 | 20230721124415     |          59 |      470 | wikitext           | NULL      |
|      30 |             10 | TranscludedTargets   |                0 |           0 | 0.825386153725 | 20230721124445 | 20230721124445     |          60 |      342 | wikitext           | NULL      |
+---------+----------------+----------------------+------------------+-------------+----------------+----------------+--------------------+-------------+----------+--------------------+-----------+
10 rows in set (0.000 sec)

The actual $query executed in QueryPage.php is

array(3) { 
["tables"]=> array(1) { [0]=> string(4) "page" }
["fields"]=> array(2) { [0]=> string(19) "page_title AS title" [1]=> string(19) "page_title AS value" }
["conds"]=> array(2) { ["page_namespace"]=> int(10) ["page_title"]=> array(0) { } }
}

The conds -> page_title strikes me and seems to come from PF_MultiPageEdit.php:L199-208 getQueryInfo
Interestingly, when I take out that condition, the query runs successfully but shows an empty result page. Clearly I'm poking with a blunt stick since I have no idea what's expected to happen when.

Change 945789 had a related patch set uploaded (by Yaron Koren; author: Yaron Koren):

[mediawiki/extensions/PageForms@master] Add handling for no results to Special:MultiPageEdit

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

Change 945789 merged by jenkins-bot:

[mediawiki/extensions/PageForms@master] Add handling for no results to Special:MultiPageEdit

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

@Meowcatx - thank you, that was very helpful. I had just assumed that this was a database problem, but your reporting caused me to actually look at the code, where I realized that this error output occurs when the page has nothing to display. I just checked in a fix, so that at least the big "stack trace" goes away. Perhaps the displayed message could still be clearer, though. Anyway, please let me know if that fixes the problem.

Hi,

thanks, I like to help;
but I'm still surprised why I get this result.
Accessing the multiedit page for template "Instrument" directly works fine:
https://my_wiki_address/msf-wiki/Special:MultiPageEdit?template=Instrument&form=Instrument
But somehow this isn't getting listed on the MultiPageEdit pages, even after runnig runJobs.php multiple times. So I guess this error ceases to be "why do we get the exception" and now is "why is our template not showing up"?

Okay, that's interesting - I had assumed that your wiki (and those of the other two people who had reported this issue) simply lacked forms, and maybe even templates. But yes, Special:MultiPageEdit can ignore existing forms - that is meant to happen when a certain template is handled by more than one form, in which case there is ambiguity about which form should be used to edit the pages that contain it. Could it be that more one form on your wiki includes the "Instrument" template?

Yes. You got me there. I literally just made a second form for Template:Instrument solely for the purpose of in-house documenting the process of making forms. Now wiped out the form and all is fine. Thanks a lot!

Yaron_Koren claimed this task.

Okay, great. It would be nice if the page explained this better, although I'm not sure how best to do that. Anyway, it looks like this particular issue can be closed now.