Page MenuHomePhabricator

SD_Filter.php: Call to a member function getDatatypeLabels() on null
Closed, ResolvedPublicBUG REPORT


Steps to Reproduce:

  1. Insert {{#drilldowninfo:filters=...}} with any filter in any category.
  2. Check Special:BrowseData for the category in which you added the parser function.

Actual Results:

[4cb7c213ec57f38223d4f457] /wiki/Especial:Buscar_datos/Bienes_culturales?Fragilidad=Alta Error from line 105 of /home/.../extensions/SemanticDrilldown/includes/SD_Filter.php: Call to a member function getDatatypeLabels() on null

Expected Results:

The drilldown interface with the configured filters in the category.

This bug is related with T246581: Semantic Drilldown is still using smwgContLang instead of the function smwfContLang().

I solved this problem in my own MediaWiki installation removing global $smwgContLang (line 104, includes/SD_Filter.php) and replacing line 105:

$datatypeLabels = $smwgContLang->getDatatypeLabels();


$datatypeLabels = smwfContLang()->getDatatypeLabels();

I am going to try to make a patch for this fix.

Event Timeline

Change 632966 had a related patch set uploaded (by Ivanhercaz; owner: Ivanhercaz):
[mediawiki/extensions/SemanticDrilldown@master] Replace $smwgContLang by smwfContLang()

This one is my first contribution to MediaWiki and Semantic Drilldown, so I hope it accomplish with all the requirements. There is another reference to $smwgContLang in .phpcs.xml but I prefer to not remove it in this patch. I think it is better to have this one merged, and then remove the another reference, linking the patch to T246581.

Change 632966 merged by jenkins-bot:
[mediawiki/extensions/SemanticDrilldown@master] Replace $smwgContLang by smwfContLang()

Ivanhercaz closed this task as Resolved.EditedOct 9 2020, 5:52 PM

With your permission, @Yaron_Koren, I mark this bug as resolved. If it needs something more, just tell me. Thank you for your reviews in the patch!

P.S. The change provide backward compatibility for SMW < 3.2.

It's definitely resolved! Thanks for this patch.