when key is empty, key option configuration save results in null exception and WSOD even after cache rebuild

Created on 5 October 2023, 9 months ago
Updated 6 October 2023, 9 months ago

Problem/Motivation

install matrix module on a new site
do not add keys, just save key option after installing the module
BOOM!
null exception
Error: Call to a member function getKeyValues() on null in line 168 of srcFormNegotiationUrlMatrixForm.php

Steps to reproduce

See summary problem

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

N/A

๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @joseph.olstad
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shreya_98

    Shreya_th โ†’ made their first commit to this issueโ€™s fork.

  • @shreya_th opened merge request.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shreya_98

    Hi @joseph.olstad,
    As per my knowledge i have tried to solve this issue .Hope so ,these changes should help prevent null exceptions when the "key" module is not installed and also created MR for this. Kindly review the changes .

    Thank you!

  • Status changed to Needs review 9 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shreya_98
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

    Hi @Shreya_th, thanks so much, that looks great, just a minor nit about the indent on the last line change.

    Great work thanks again!

  • Status changed to RTBC 9 months ago
  • First commit to issue fork.
  • Assigned to wilco
  • Status changed to Fixed 9 months ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada wilco
  • Status changed to Fixed 9 months ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada wilco
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada wilco

    Great catch everyone!

    I've gone ahead and reviewed the request. Modified it to better handle the conditional and ensure proper handling of null values.

    Enjoy!

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shreya_98

    Hi @wilco,
    I have given my valuable time to fix this issue , will you please tell me where is my mistake due to which i didn't receive credit on this issue.

    Thank you!

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada wilco

    Hi @shreya_th,

    If you review the code changes you made, they were only fixing some variable setting conventions but it actually didn't solve the NULL value errors. You can review the following code changes here:

    https://git.drupalcode.org/project/language_negotiation_matrix/-/merge_r...

    The modifications you made left an error behind here:

    $module_handler->moduleExists('key')

    As well, if the call \Drupal::service('key.repository')->getKey('language_matrix')->getKeyValues() came back null, it would still WSOD.

    Therefore, more conditionals were required. Not to put to fine a point on it, your changes didn't actually solve the fundamental issue.

    I thank you for your efforts, but it wasn't enough to fix the issue.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada wilco

    I made an edit error in my comment above, so I corrected it. But just to be clear:

    ['%enabled' => $module_exists('key')?'Enabled':'Not Installed'])

    This in particular $module_exists('key') was the problem. After your fix, this was now throwing errors.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

    Thanks @Shreya_th and @wilco for your work on this.

    Very cool module!

Production build 0.69.0 2024