seo-by-rank-math icon indicating copy to clipboard operation
seo-by-rank-math copied to clipboard

PHP Warning with the Table of Content: Undefined array key "titleWrapper"

Open MathieuLamiot opened this issue 8 months ago • 0 comments

Describe the bug Rankmath Version 1.0.219 WordPress is reporting many PHP Warnings linked to SEO by Rank Math plugin. It seems to happen when loading a page using the table of content block from the RankMath plugin. Here are details about the warning report on my website on Sentry: https://mathieu-lamiot.sentry.io/share/issue/da8c94003d2642e9b56b8b572fc4a3dc/

The warning comes from: /wp-content/plugins/seo-by-rank-math/includes/modules/schema/blocks/toc/class-block-toc.php in RankMath\Schema\Block_TOC::render_toc_block_content at line 103 for Warning: Undefined array key "titleWrapper". In my case, from the Sentry report:

$parsed_block = {

   attrs: {

      headings: [
         13 items
      ],
      listStyle: ul
   },
   blockName: rank-math/toc-block,
   innerBlocks: [],

   innerContent: [
      1 item
   ]
}

To Reproduce Steps to reproduce the behavior:

  1. Create a WP post with the "Table of content" block from SEO By Rank Math.
  2. Visit the page
  3. Check PHP warnings.

Expected behavior If it is expected that titleWrapper can be undefined, the plugin should not create warnings ; with a check and bail-out for instance. If it is not expected for titleWrapper to be undefined, then this case should not occur.

Screenshots NA

Desktop (please complete the following information):

  • OS: MacOS 14.3
  • Browser Chrome
  • Version 124

MathieuLamiot avatar May 29 '24 20:05 MathieuLamiot