Page MenuHomePhabricator

MWException for Cargo when using apostrophe in table name
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. Create a template for a Cargo table that includes a row with a word that has an apostrophe, in this case "King's rock" (see https://test3.miraheze.org/w/index.php?title=Template:Moves&action=edit)
  2. Create the Cargo template with ?action=recreatedata
  3. MWException occurs because of the apostrophe existing
[39350b6496152e62bce16352] /wiki/Special:CargoTables/Moves   MWException from line 405 of /srv/mediawiki/w/extensions/Cargo/includes/CargoUtils.php: Error: unclosed string literal.
/srv/mediawiki/w/extensions/Cargo/includes/CargoSQLQuery.php:545, /srv/mediawiki/w/extensions/Cargo/includes/CargoSQLQuery.php:691, /srv/mediawiki/w/extensions/Cargo/includes/specials/CargoTables.php:185, /srv/mediawiki/w/includes/specialpage/SpecialPage.php:600, /srv/mediawiki/w/includes/specialpage/SpecialPageFactory.php:635, /srv/mediawiki/w/includes/MediaWiki.php:307, /srv/mediawiki/w/includes/MediaWiki.php:940, /srv/mediawiki/w/includes/MediaWiki.php:543, /srv/mediawiki/w/index.php:53, /srv/mediawiki/w/index.php:46

MediaWiki: 1.35.1
PHP: 7.3.27-1~deb10u1 (fpm-fcgi)
MariaDB: 10.4.15-MariaDB-1:10.4.15+maria~buster-log

Event Timeline

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

That's definitely a bug that should be fixed, although it really is better to avoid apostrophes in field names - running queries on such fields is always going to be a pain. Actually, maybe Cargo should just disallow apostrophes (and double quotes, for that matter) in field names.

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

[mediawiki/extensions/Cargo@master] Disallow single and double quotes in table and field names

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

Change 928094 merged by jenkins-bot:

[mediawiki/extensions/Cargo@master] Disallow single and double quotes in table and field names

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

Yaron_Koren claimed this task.

Apostrophes are now disallowed, finally.