- Issue created by @maxilein
- 🇦🇹Austria maxilein
I can edit that menu when the better mega menu is not installed.
- Assigned to agunjan085
- 🇺🇸United States themodularlab
Looks like this might be an issue with Core or at least a conflict between TB and Core. See https://www.drupal.org/project/drupal/issues/3352384 ✨ Add Exception for TypeError Argument must be String in \Drupal\Component\Utility\Html escape{} Needs work . While that issue is flagged as 9.5 the patch and issue still apply to D10. I'm currently investigating to see what can be done about this.
- Status changed to Postponed: needs info
over 1 year ago 8:24pm 13 June 2023 - 🇺🇸United States themodularlab
This is definitely an issue with Core. I don't think this is anything that is wrong or done incorrectly with TB Mega Menu related to this bug . Even after removing any references to functions that use the escape() function or htmlspecialchars(), etc. I still encounter the error. And it only happens after saving the menu from the core menu manager (and not TB).
-
themodularlab →
committed 0d04acba on bugfix/TBMM-3366359
git commit -m 'Issue #3366359 by themodularlab: After installing: error...
-
themodularlab →
committed 0d04acba on bugfix/TBMM-3366359
-
themodularlab →
committed c282baac on 3.x
git commit -m 'Issue #3366359 by themodularlab: After installing: error...
-
themodularlab →
committed c282baac on 3.x
-
themodularlab →
committed 0d04acba on 3.x
git commit -m 'Issue #3366359 by themodularlab: After installing: error...
-
themodularlab →
committed 0d04acba on 3.x
-
themodularlab →
committed be412a2f on 3.x
git commit -m 'Issue #3366359 by themodularlab: After installing: error...
-
themodularlab →
committed be412a2f on 3.x
-
themodularlab →
committed 88d431fe on 2.x
Issue #3366359 by themodularlab: After installing: error on edit and...
-
themodularlab →
committed 88d431fe on 2.x
- Status changed to Fixed
over 1 year ago 1:43am 14 June 2023 - Issue was unassigned.
- 🇨🇦Canada nikathone Ontario
It looks like this was partially fixed. I just experienced
TypeError: strlen(): Argument #1 ($string) must be of type string, array given in strlen() (line 477 of /code/web/core/lib/Drupal/Component/Utility/Unicode.php) #0 /code/web/core/lib/Drupal/Component/Utility/Unicode.php(477): strlen(Array) #1 /code/web/core/lib/Drupal/Component/Utility/Xss.php(65): Drupal\Component\Utility\Unicode::validateUtf8(Array) #2 /code/web/modules/contrib/tb_megamenu/src/Entity/MegaMenuConfig.php(176): Drupal\Component\Utility\Xss::filter(Array) #3 /code/web/modules/contrib/tb_megamenu/src/TBMegaMenuBuilder.php(149): Drupal\tb_megamenu\Entity\MegaMenuConfig->getMenuConfig() #4 /code/web/modules/contrib/tb_megamenu/includes/tb_megamenu.theme.inc(254): Drupal\tb_megamenu\TBMegaMenuBuilder->getMenuConfig('main', '...') #5 [internal function]: template_preprocess_tb_megamenu(Array, 'tb_megamenu', Array) #6 /code/web/core/lib/Drupal/Core/Theme/ThemeManager.php(287): call_user_func_array('template_prepro...', Array)
- 🇺🇸United States themodularlab
@nikathone,
Are you using captions? How we were previously handling captions ended up triggering an issue that's occurring in core so I had to refactor it a bit to work around it. My guess is that if you are using captions. It may be trying to pass that as an array because that's how it was orginally being set. You may just need to go into the TB menu settings, resave (hopefully not re-input captions), and then clear caches.
If that doesn't fix the issue, let me know and I can investigate further.
- 🇺🇸United States yospyn
Hi @themodularlab the problem is we can't get into TB menu settings either. I can get to /admin/structure/tb-megamenu, but when I edit the megamenu I get a white screen. Anything using the front-end theme is broke, as I can't even log into the site.
- 🇨🇦Canada nikathone Ontario
We had to apply a local patch for the time being. Not sure if this is the right approach though.
- 🇺🇸United States themodularlab
@yospyn, We did release a new alpha of for the 2.x and the 3.x branch that should have addressed the white screen issues. You may need to try @nikathone's patch.
@nikathone,
I'll look to add your patch and see what other improvements we can make here.Sorry for the issues everyone is having.
-
themodularlab →
committed 9a6f4d22 on bugfix/TBMM-3366359-2x authored by
nikathone →
Issue #3366359 by nikathone, themodularlab: After installing: error on...
-
themodularlab →
committed 9a6f4d22 on bugfix/TBMM-3366359-2x authored by
nikathone →
-
themodularlab →
committed 6554a229 on bugfix/TBMM-3366359-2x authored by
nikathone →
Issue #3366359 by nikathone, themodularlab: After installing: error on...
-
themodularlab →
committed 6554a229 on bugfix/TBMM-3366359-2x authored by
nikathone →
-
themodularlab →
committed 856ddb24 on bugfix/TBMM-3366359
Issue #3366359 by nikathone, themodularlab: After installing: error on...
-
themodularlab →
committed 856ddb24 on bugfix/TBMM-3366359
- Status changed to Needs review
over 1 year ago 3:28pm 15 June 2023 - 🇺🇸United States themodularlab
@yospyn,
I added a merge request for both 2.x (d8/9) and 3.x (d10). Let me know know if these fix your issues. Here's a patch from the MR for each version:
2.x: https://git.drupalcode.org/project/tb_megamenu/-/merge_requests/74/diffs...
3.x: https://git.drupalcode.org/project/tb_megamenu/-/merge_requests/73/diffs...I'm moving this to Needs Review.
@nikathone,
Thanks again for your patch. I made a couple of adjustments in order to account for arrays AND to maintain the sanitization of the text since it allows some html.
- 🇨🇦Canada nikathone Ontario
@themodularlab I think there is no need to use
Xss::filter($caption['#plain_text']);
because drupal should take care of that. See https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Co... and https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Co.... This means you can safely do$config[$key]['item_config']['caption'] = $caption;
when caption is an array.I think I think doing
$caption = $value['item_config']['caption'] ?? NULL; $config[$key]['item_config']['caption'] = is_string($caption) ? Xss::filter($caption) : $caption;
should be enough unless caption is not supposed to be set to NULL. In this case they should some validation somewhere else in the code to stop this from happening.
- Status changed to Fixed
9 months ago 3:35pm 29 March 2024 -
themodularlab →
committed 05127e76 on 3.x
Issue #3366359 by nikathone, themodularlab: After installing: error on...
-
themodularlab →
committed 05127e76 on 3.x
Automatically closed - issue fixed for 2 weeks with no activity.