Warning: Trying to access array offset on value of type bool in Drupal\opigno_module\Controller\OpignoModuleController->userResult() (line 937 of modules/contrib/opigno_module/src/Controller/OpignoModuleController.php).

Created on 29 December 2022, almost 2 years ago
Updated 4 January 2024, 11 months ago

Problem/Motivation

New installation using "composer create-project opigno/opigno-composer:^3.0"

Steps to reproduce

1.- New installation
2.- Add Training path + 1 course + 1 module + 1 activity (type Column with one youtube link video, text field and true false question)
3.- Set Training public
4.- Try to access without login
5.- Apply Path: https://www.drupal.org/files/issues/2021-11-10/opigno_catalog-fix_bad_cu... β†’
6.- Try to access again, but same result

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain luis_mejia Barcelona

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Active over 1 year ago
  • πŸ‡«πŸ‡·France flocondetoile Lyon

    I've got this error too

    Warning: Trying to access array offset on value of type bool in Drupal\opigno_module\Controller\OpignoModuleController->userResult() (line 937 of modules/contrib/opigno_module/src/Controller/OpignoModuleController.php).

    In the module result page after complete a training.

    This is because the course has no mandatory_steps

    So line 936

    $last_mandatory_step = end($mandatory_steps);
    

    return FALSE because $mandatory_steps is empty.

    And so the next line (937)

    $last_mandatory_step_key = array_search($last_mandatory_step["cid"], $steps_cids_mapping);
    

    generate the warning notice

    In the steps described in the issue summary, I think the mention, that none activity has been set as mandatory, has been forgetten.

  • Status changed to Needs review over 1 year ago
  • πŸ‡«πŸ‡·France flocondetoile Lyon

    This should do the trick

  • πŸ‡ΊπŸ‡ΈUnited States tlwatson

    Rerolled #5 patch.

Production build 0.71.5 2024