dispalying "> instead of translation flags
I get this error when trying to display the flags of translation with plugin polylang.
I tried WPML and i got also an error
Notice: A non well formed numeric value encountered in /wp-content/plugins/brizy-pro/content/placeholders/menu-loop-submenu.php on line 33
I tried to cast (int) on the parameter of line but it didn´t work and i also don´t like to change files of the plugins that will be erased on next update.
I assume that this error has introduced in some recent version of brizy
From chatgpt i got
The notice "A non well-formed numeric value encountered" in the context of line 33 (private function hasSubMenu(array $menu_items, int $id)) suggests that somewhere in your code, the second argument $id, which is expected to be an int, is receiving a value that is either not numeric or not well-formed as a numeric value.
Steps to Fix:
-
Check Where the Function Is Called: The function
hasSubMenu()is likely called elsewhere in your code, and the second argument ($id) should be an integer. Search for where this function is invoked (like on line 24 from your previous error) and inspect the value of$idthat's being passed. -
Ensure Proper Type Casting: Ensure that when
hasSubMenu()is called, the second argument is always passed as an integer. You can force this by casting the value to an integer before passing it:phpCopiar código$this->hasSubMenu($menu_items, (int)$id); -
Sanitize Input Before Calling the Function: Before calling
hasSubMenu(), make sure that the value being passed as$idis numeric. You can log it to check if it's not a valid integer:phpCopiar códigoerror_log('ID being passed: ' . print_r($id, true));If it turns out that the
$idis not numeric or is a string, you should validate it. For instance:phpCopiar códigoif (is_numeric($id)) { $this->hasSubMenu($menu_items, (int)$id); } else { error_log('Non-numeric ID passed: ' . $id); } -
Use Type Checking in the Function (if needed): Although PHP 7 and later enforce strict typing if you declare function parameters like
int, it might still be useful to add a check inside the function in case the type is somehow missed:phpCopiar códigoprivate function hasSubMenu(array $menu_items, int $id) { if (!is_int($id)) { throw new \InvalidArgumentException('ID must be an integer'); } // Your logic here... }
-
Hi Paulo,
Thank you for reaching out to us.
We are already aware of this issue and a fix should be available soon. If this is urgent, you may consider switching to older versions until we address this issue - https://tinyurl.com/Brizy-Older-Versions
Sorry for the inconvenience.
Best regards,
Ariel H.0
Please sign in to leave a comment.
Comments
1 comment