Page MenuHomePhabricator

Cargo 3.2 Query to Template Bug
Closed, ResolvedPublic

Description

I recently updated to Cargo 3.2 (from Cargo 2.7) and it broke my cargo_query(ies) that used format=template.

Empty fields are not passed to the template. This will cause shifting of fields in the template output.

The temporary work-around is to use "named args=yes" and change the template from numbered inputs ({{{1|}}}, {{{2|}}} etc.) to named inputs ({{{name|}}}, {{{address|}}}, etc.). However, this means recoding any template used to format a cargo query.

This issue may be related to:
Cargo HTML created by "format=template" is escaped on-page, also affects PageForms queries.
https://phabricator.wikimedia.org/T295732

Event Timeline

Sorry about that. Since you're running Cargo 3.2, I believe you can actually get around this problem by adding the following to LocalSettings.php:

$wgCargoLegacyStoreNullAsEmptyString = true;

Actually, looking at your question again, that might be an unrelated fix.

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

[mediawiki/extensions/Cargo@master] Fix null value display for format=template with unnamed args

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

Change 799463 merged by jenkins-bot:

[mediawiki/extensions/Cargo@master] Fix null value display for format=template with unnamed args

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

Yaron_Koren claimed this task.

I believe this bug is fixed now. Sorry for the problems!