SemanticMediaWiki / SemanticResultFormats

Provides additional visualizations (result formats) for Semantic MediaWiki
https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Result_Formats
Other
45 stars 75 forks source link

[Gallery] Gallery.php: Call to a member function recursiveTagParse() on bool #716

Closed gesinn-it-gea closed 1 year ago

gesinn-it-gea commented 2 years ago

Error from line 341 of [...]/Gallery.php: Call to a member function recursiveTagParse() on bool

if ( $this->params['captiontemplate'] !== '' ) {
  $templateCode = "{{" . $this->params['captiontemplate'] .
    "|imageraw=".$imgTitle->getPrefixedText()."|imagecaption=$imgCaption|imageredirect=$imgRedirect}}";

  $imgCaption = $ig->mParser->recursiveTagParse( $templateCode );
}
gesinn-it-gea commented 2 years ago

This happens during an api call to api.php?action=pfautoedit

gesinn-it-gea commented 2 years ago

A quick workaround (to be validated and test covered) is:

if ( $this->params['captiontemplate'] !== '' && gettype($ig->mParser) == "object" ) {
  $templateCode = "{{" . $this->params['captiontemplate'] .
    "|imageraw=".$imgTitle->getPrefixedText()."|imagecaption=$imgCaption|imageredirect=$imgRedirect}}";

  $imgCaption = $ig->mParser->recursiveTagParse( $templateCode );
}
gesinn-it-gea commented 1 year ago

This also happens when moving a page that contains a query with format gallery using a caption.

Steps to reproduce: