Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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.
    #1097043

    Hey 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,
    Rikard

    #1097745

    Hi 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.

    #1097969

    Hi,

    Thanks for the feedback. It would be great if you could share your solution with us.

    Best regards,
    Rikard

    #1098155

    I 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.
    #1098827

    Hi smartstartinc,

    Thank you for sharing.

    Best regards,
    Victoria

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.