Missing stack trace

Created on 21 January 2022, about 3 years ago
Updated 28 April 2023, almost 2 years ago

Problem/Motivation

Background

I've installed the module using `composer require drupal/jsnlog` and added the jsnlog library using `composer require mperdeck/jsnlog` (after adding the following to my composer.json):

        "jsnlog": {
            "type": "package",
            "package": {
                "name": "mperdeck/jsnlog",
                "version": "v2.30.0",
                "type": "drupal-library",
                "dist": {
                    "url": "https://github.com/mperdeck/jsnlog.js/archive/refs/tags/v2.30.0.zip",
                    "type": "zip"
                }
            }
        }

Issue

When using the 'Trigger test error' in the settings page ('/admin/config/development/jsnlog'), an error reports in the recent log messages ('/admin/reports/dblog'), which is great.

However I'm also seeing the following error relating to a missing stack:

Notice: Undefined index: stack in Drupal\jsnlog\Controller\AjaxLogController->parseMsg() (line 108 of modules/contrib/jsnlog/src/Controller/AjaxLogController.php).

Which relates to this line:

$log_data['stack'] = explode("\n", $log_data['stack']);

Steps to reproduce

  1. Install the module and required library*
  2. Create a test error on '/admin/config/development/jsnlog'
  3. View the logs e.g. DBlog if enabled '/admin/reports/dblog'

* Note - I tried installing the library following the steps in the readme however the library wasn't installing for me. So I opted to install as a composer repository. I haven't been able to test this bug when using the readme library steps.

Expected behaviour

  1. The logs report the JS error
  2. The logs do not report any other errors

Actual behaviour

  1. The logs report the JS error
  2. The logs also report an error with the stack index in AjaxLogController.php

Proposed resolution

Add a check to see if the stack index exists within AjaxLogController.php

πŸ› Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom Rob Howells

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.

Production build 0.71.5 2024