Error:
Error: Call to a member function getDefinitionMatch() on null in Drupal\micon\MiconIconize->getMatch() (line 218 of /home/sites/lastD8/web/modules/contrib/micon/src/MiconIconize.php)

quick workaround:
on "micon/src/MiconIconize.php" (line 218)
change

if ($icon_id = $this->miconDiscoveryManager->getDefinitionMatch($prefix . $string)) {

to
if (method_exists($this->miconDiscoveryManager, 'getDefinitionMatch') && $icon_id = $this->miconDiscoveryManager->getDefinitionMatch($prefix . $string)) {

CommentFileSizeAuthor
#7 3172262-3.patch620 bytesgrevil
#2 3172262-2.patch622 byteskarishmaamin

Comments

steveoriol created an issue. See original summary.

karishmaamin’s picture

StatusFileSize
new622 bytes

Here is the patch

suresh prabhu parkala’s picture

Status: Active » Needs review
jacobbell84’s picture

Status: Needs review » Postponed (maintainer needs more info)

I'm not able to reproduce this, can you provide more details on your setup? What Drupal version you're on, which Micon modules you're using, etc. Thanks.

steveoriol’s picture

Some infos juste after install module on D9.1.2 :
drush ws

 ------ -------------- ----------------- ------------- -----------------
  ID     Date           Type              Severity      Message                                                                                                              
 ------ -------------- ----------------- ------------- -----------------
  6807   07/Jan 14:18   php               Erreur        Error: Call to a member function getDefinitionMatch() on null in Drupal\micon\MiconIconize->getMatch() (line 218 of /home/sites/drupal-9-dp/web/modules/contrib/micon/src/MiconIconize.php)                                              
  6806   07/Jan 14:17   system            Info          micon_menu module installed.                                                                                         
  6805   07/Jan 14:17   system            Info          micon_local_task module installed.                                                                                   
  6804   07/Jan 14:17   system            Info          micon_link module installed.                                                                                         
  6803   07/Jan 14:17   system            Info          micon module installed.    

The patch #2 works...

anybody’s picture

Does this still occur with 2.x? Otherwise we should set this outdated.

grevil’s picture

StatusFileSize
new620 bytes

I could not reproduce the error on login for 2.x.

Although, the "$miconDiscoveryManager" class annotation was declared as a "\Drupal\micon\MiconIconManager" instead of "\Drupal\micon\MiconDiscoveryManager". I created a small patch with this fix and another tiny variable type doc fix.

Furthermore, patch #2 is quite dirty. As the main problem was, that "$this->miconDiscoveryManager" seems to not have been properly initialized, so it was NULL. Leading to method_exists(NULL, 'getDefinitionMatch'), which never resolves to be true.

Setting this to outdated.

grevil’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)