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
- Install the module and required library*
- Create a test error on '/admin/config/development/jsnlog'
- 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
- The logs report the JS error
- The logs do not report any other errors
Actual behaviour
- The logs report the JS error
- 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