-
AuthorPosts
-
May 2, 2019 at 10:15 pm #1096589
I am repeatedly getting this warning in my logs:
PHP Warning: A non-numeric value encountered in /wp-content/themes/enfold/framework/php/function-set-avia-backend.php on line 594 PHP Warning: A non-numeric value encountered in /wp-content/themes/enfold/framework/php/function-set-avia-backend.php on line 594 PHP Warning: A non-numeric value encountered in /wp-content/themes/enfold/framework/php/function-set-avia-backend.php on line 594
- This topic was modified 5 years, 7 months ago by Michael.
May 4, 2019 at 4:47 am #1097043Hey Michael,
That is a warning, not a real error. It shouldn’t affect anything on your site. If you need further help then we need to be able to reproduce the problem on your actual site.
Best regards,
RikardMay 6, 2019 at 5:09 pm #1097745Hi Rikard,
I know it’s a warning and not a real error. Still, the theme code should not produce this warning as PHP it is not expecting the value type received and by the values in the array provided. The theme code should filter invalid types with some sort of conditional statement, or at the source, the values should be validated before being added or stored in the array or data.
For the time being, I have added a conditional statement around offending line of code reported, checking if the incoming value is actually a number.
May 7, 2019 at 7:29 am #1097969Hi,
Thanks for the feedback. It would be great if you could share your solution with us.
Best regards,
RikardMay 7, 2019 at 6:16 pm #1098155I already said what I did, but here is the entire code block:
if(!function_exists('avia_backend_merge_colors')) { /** * merges to colors * @param string $color1 hex color code * @param string $color2 hex color code * @return new color */ function avia_backend_merge_colors($color1, $color2) { if(empty($color1)) return $color2; if(empty($color2)) return $color1; $prepend = array("", ""); $colors = array(avia_backend_hex_to_rgb_array($color1), avia_backend_hex_to_rgb_array($color2)); $final = array(); foreach($colors[0] as $key => $color) { if (is_numeric($colors[0][$key]) && is_numeric($colors[1][$key])) { $final[$key] = (int) ceil(($colors[0][$key] + $colors[1][$key]) / 2); } } return avia_backend_get_hex_from_rgb($final[0], $final[1], $final[2]); } }
- This reply was modified 5 years, 7 months ago by Michael.
May 9, 2019 at 10:10 am #1098827Hi smartstartinc,
Thank you for sharing.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.