Closed (fixed)
Project:
Toc.js
Version:
3.2.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Sep 2025 at 08:55 UTC
Updated:
18 Sep 2025 at 10:39 UTC
Jump to comment: Most recent
Hello, I've been getting this error message for a few days. Do you know where it might be coming from?"
Warning: Undefined array key "back_to_toc_label" in toc_js_node_view() (line 181 of modules/contrib/toc_js/toc_js.module).
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mably commentedJust to clarify, is this showing up only as a warning in the logs, or is it also affecting how your site works?
This code shouldn't generate a warning thoug:
Xss::filter((string) $toc_js_settings['back_to_toc_label'] ?? '', ['span'])Are you sure you are on latest 3.2.1 version?
EDIT: Ok, it looks like the cast takes precedence over the
??, could you try adding some parenthesis around to see if it fixes your problem ?Xss::filter((string) ($toc_js_settings['back_to_toc_label'] ?? ''), ['span'])Created an MR with the fix.
Comment #4
mably commentedComment #5
cyril64 commentedThank you. It solved the problem with :
Xss::filter((string) ($toc_js_settings['back_to_toc_label'] ?? ''), ['span'])
Comment #7
mably commentedThanks for the feedback. Let's merge this!