SemanticMediaWiki / SemanticResultFormats

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

Graph format: $node variable is not initialized in the else block #549

Closed jewloszewicz closed 1 year ago

jewloszewicz commented 5 years ago

Setup

Issue

Error from line 186 of /var/www/smw/extensions/SemanticResultFormats/src/Graph/GraphPrinter.php: Call to a member function addParentNode() on null

JeroenDeDauw commented 5 years ago

Thanks for reporting this issue!

Ping @SbstnS

SbstnS commented 5 years ago

@jewloszewicz can you please post your inline query which causes this error so i can reproduce it.

SbstnS commented 5 years ago

@jewloszewicz I'm working with the same setup as you've described above but I never run into this error.

You may have made some mistakes during installing the extension. Please check the installation guide.

https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Result_Formats/Installation

jewloszewicz commented 5 years ago

@SbstnS Unfortunately, I don't have access to that instance anymore.

There is a mistake in the code. $node in the else statement is not initialized.

https://github.com/SemanticMediaWiki/SemanticResultFormats/blob/1b983766322732e50fa6f613e006c223f7bd9533/src/Graph/GraphPrinter.php#L168-L187

SbstnS commented 5 years ago

@jewloszewicz I'm not sure how then you can run into this error that you've described above....

Error from line 186 of /var/www/smw/extensions/SemanticResultFormats/src/Graph/GraphPrinter.php: Call to a member function addParentNode() on null

To me everything works as expected! If i had your inline query than i could cover the hole test scenario...

Here is the one that I used for testing.

{{#ask:[[Category:Team]]
  |?Part Of Team
  |format=graph
  |graphcolor=yes
  |graphlink=yes
  |graphname=PeopleKnows
  |graphlegend=yes
  |graphlabel=yes
  |graphsize=10,100
  |nodelabel=displaytitle
}}
SbstnS commented 5 years ago

@JeroenDeDauw But I noticed a few parts while testing the code that could be improved. I'll do this in a new PullRequest.

alex-mashin commented 1 year ago

I think, this bug has been fixed by #749.