Unidentified Index on_off in _tableofcontents_filter_process()

Created on 15 April 2013, over 11 years ago
Updated 15 December 2023, 11 months ago

Upon installing this plugin I get this error,

Undefined index: on_off in _tableofcontents_filter_process() (line 79 of /home/tpol/public_html/polymath.cc/sites/all/modules/tableofcontents/tableofcontents.filters.inc).

πŸ› Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States roadran422

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.

  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

    an isset($toc['on_off']) would also work, but this is still good (they made the array_key_exists faster in PHP 8)

  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

    The notices in #1 I'm seeing when a views page show the body field

        Warning: Undefined array key "on_off" in _tableofcontents_apply_toc() (line 155 of /var/www/html/public/sites/all/modules/contrib/tableofcontents/tableofcontents.module).
        Warning: Trying to access array offset on value of type null in _tableofcontents_apply_toc() (line 155 of /var/www/html/public/sites/all/modules/contrib/tableofcontents/tableofcontents.module).
    

    I found that it was due to 'text_trimmed' because the toc was expanded then truncated.
    [toc on_off::hide=0 on_off::automatic=0 on_off::min_limit=5 box::title=On+this+page box::minlevel=2 box::maxlevel=3 box::hide_show=1 box::collapsed=0 header::id_strip::digits=0 header::id_strip::dashes=0 header::id_strip::periods=0 header::id_strip::

    Ideally if that is the context, we'd strip out the [toc] and not expand it with settings. I'll try to write a patch for this later.

  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

    I made no headway on this except confirming it's a problem. There is indication here of the problem #1891420: panel page wrong markup β†’ in toc_filter

    The gist is that we have the context of it being "text_trimmed" but it's too late and it's already been trimmed. One solution could be to get the original value, strip out the [toc...] knowing the "text_trimmed" context, and re-run the filters (and avoid the infinite loop) but that seems super wasteful...

Production build 0.71.5 2024