Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.x Fix Menu theme locations array to enforce string or integers #2707

Merged
merged 1 commit into from Feb 28, 2023

Conversation

mcaskill
Copy link
Contributor

Issue

With Timber v2 , WPML, and PHP 8, if any nav menu location happens to be null, this warning occurs:

Warning: array_flip(): Can only flip string and integer values, entry skipped in vendor/timber/timber/src/Menu.php on line 255

This is similar to issue #2576 where the warning was with MenuFactory::get_menu_location().

Solution

The solution is to apply the same fix made to MenuFactory; filter the nav menu locations array to enforce strings or integers.

Testing

The TestTimberMenu::testThemeLocationProperty() method was updated to match TestMenuFactory::testGetMenuLocation().

@coveralls
Copy link

Coverage Status

Coverage: 88.685% (+0.003%) from 88.683% when pulling 781b8b8 on mcaskill:2.x-fix-menu-theme-locations into c96b9f8 on timber:2.x.

@gchtr gchtr added the 2.0 label Feb 28, 2023
Copy link
Member

@gchtr gchtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix, @mcaskill! 👍

@gchtr gchtr merged commit 8c07684 into timber:2.x Feb 28, 2023
@mcaskill mcaskill deleted the 2.x-fix-menu-theme-locations branch February 28, 2023 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants