Problem/Motivation

The module triggers notices whenever a term/key that should be highlighted has unexpected white spaces.

Notice: Undefined index: term name in Drupal\glossify\GlossifyBase->parseTooltipMatch() (Zeile 104 in PROJECT/html/modules/contrib/glossify/src/GlossifyBase.php)

Examples:

  • trailing whitespaces (term name )
  • leading whitespaces ( term name)
  • consecutive whitespaces (term name)

For term entities, the first to cases should not be expected (term names are trimmed by UI saves, unless created programmatically e.g. on migrations). For the third case, there seems to already be handling in place, however that variable ($term_norm) is never used.

Proposed resolution

Ignore cases one and two as edge cases triggered by developer fault, as they only happen on custom code/migrations.
Actually make use of $term_norm to resolve the third case.

Remaining tasks

Review.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ckaotik created an issue. See original summary.

ckaotik’s picture

Assigned: ckaotik » Unassigned
Status: Active » Needs review
FileSize
587 bytes

I've attached a patch that makes use of $term_norm.

  • ckaotik authored 6aa7153 on 8.x-1.x
    Issue #2944189 by ckaotik: Fragile with unexpected whitespaces
    
keesje’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.