Tagged: 

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #710997

    We are getting this error at the top of our site:
    Notice: Undefined variable: http_response_header in /public_html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 637

    I’ve already reinstalled twice and disabled plugins, nothing is helping. What can we do?

    #711012

    Hi pippylu!

    Please reupload the theme through ftp and let us know if that will solve your issue.

    Thanks a lot

    Regards,
    Basilis

    #715688

    We already tried this an it did not help.

    #716663

    Hi,

    We have reported the issue to Kriesi. Please post the FTP details here so that we can do a few tests.

    Best regards,
    Ismael

    #717020

    FTP info below:

    #718620

    Hi,

    Thank you for the info. Did you delete this video file?

    // Fran-Connect-2-0-FINAL.webm

    We modified the wp-config.php file to hide the errors temporarily.

    define('WP_DEBUG_DISPLAY', false);
    

    Best regards,
    Ismael

    #719030

    This is a dev site so you don’t need to hide it, we already have it hidden on the live site. I want to see the errors so I know they’ve gone away.
    I don’t know anything about that video file – is that what is causing the issue?

    #720292

    Hi,

    Yes, the conditional function is called whenever a media file is added to the theme. Unfortunately, this function is causing an issue because the array that is supposed to be populated when calling the file_get_contents function is blank or undefined. Please try to clean up the database using this plugin.

    // https://wordpress.org/plugins/wp-optimize/

    Best regards,
    Ismael

    #722182

    Where is there a reference to that video file? Running WP Optimize did not help. I searched the entire database and see no reference to Fran-Connect-2-0-FINAL.webm. Just Fran-Connect-2-0-FINAL.mp4 which is used on the homepage and exists.

    • This reply was modified 7 years, 11 months ago by christiemade.
    #723526

    Hi,

    The error is due to the mp4 video inside the color section. You need to use the absolute instead of the relative url.

    // http://unlikelyheroine.com/wp-content/uploads/2016/10/Fran-Connect-2-0-FINAL.mp4

    Best regards,
    Ismael

    #791686

    Hi Ismael,

    I have exactly the same error:

    Notice: Undefined variable: http_response_header in /public_html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 637
    Notice: Undefined variable: http_response_header in /public_html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 637
    Notice: Undefined variable: http_response_header in /public_html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 637

    On the homepage of one of our sites.

    I have reinstalled the theme, tested with no plugins activated, optimised the database, tried the link to a video in the first color section as relative and absolute, www and non-www, https & http.

    The site is https://www.webworksuk.com/

    What have we missed?

    Thanks,
    Joe

    #792020

    Hi,

    Please edit the framework > php > function-set-avia-frontend.php file then look for the avia_is_200() function. Replace it with the following code.

    if(!function_exists('avia_is_200'))
    {
    	function avia_is_200($url)
    	{
    	    $options['http'] = array(
    	        'method' => "HEAD",
    	        'ignore_errors' => 1,
    	        'max_redirects' => 0
    	    );
    	    $body = @file_get_contents($url, NULL, stream_context_create($options), 0, 1);
    	    if(isset($http_response_header[0])) {
    			sscanf($http_response_header[0], 'HTTP/%*d.%*d %d', $code);
    		} else {
    			$headers = get_headers($url);
    			sscanf($headers[0], 'HTTP/%*d.%*d %d', $code);
    		}
    	    return $code === 200;
    	}
    }

    Best regards,
    Ismael

    #792235

    Hi Ismael,

    Will this be included in the next update?

    Thanks,
    Joe

    #792237

    Hi Ismael,

    That’s produced the foollowing errors in place of the orginal:

    Warning: get_headers(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/webworksuk/public_html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 640

    Warning: get_headers(): This function may only be used against URLs in /home/webworksuk/public_html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 640

    Warning: get_headers(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/webworksuk/public_html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 640

    Warning: get_headers(): This function may only be used against URLs in /home/webworksuk/public_html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 640

    Warning: get_headers(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/webworksuk/public_html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 640

    Warning: get_headers(): This function may only be used against URLs in /home/webworksuk/public_html/wp-content/themes/enfold/framework/php/function-set-avia-frontend.php on line 640

    #792488

    Hi,

    Please ask your hosting provider to fix the problem.
    It is located here
    allow_url_fopen=0

    as they are blocking it.

    Thank u

    Best regards,
    Basilis

    #1167342

    This issue persists (2019-12-18, Enfold v4.6.3.1).

    allow_url_fopen = 0 is a good security setting in a shared environment (notice: it also disables get_headers(), so if one is not available – so is the other!). I have a better fix for this situation, since all you really need to know is whether the remote URL exists or not:

    if(!function_exists('avia_is_200'))
    {
        function avia_is_200($url)
        {
            if ( ini_get('allow_url_fopen') )
                return __avia_is_200_helper_fopen($url);
            else if ( function_exists("curl_init") )
                return __avia_is_200_helper_curl($url);
            else return false;
        }
    
        function __avia_is_200_helper_fopen($url)
        {
            $options['http'] = array(
                'method' => "HEAD",
                'ignore_errors' => 1,
                'max_redirects' => 0
            );
            $body = @file_get_contents($url, null, stream_context_create($options), 0, 1);
            sscanf($http_response_header[0], 'HTTP/%*d.%*d %d', $code);
            return $code === 200;
        }
    
        function __avia_is_200_helper_curl($url)
        {
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_NOBODY, true);
            curl_setopt($ch, CURLOPT_TIMEOUT, 10);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
            // security isn't an issue in this case, and you can skip maintaining the root CA .pem required for this
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_exec($ch);
            $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            curl_close($ch);
            return $code === 200;
        }
    }
    #1168803

    Thanks, ellmann_creative, that worked for me too.

    I’d be bummed if I had to carry this in my child theme forever, if it’s a core issue…

    #1168958

    Hi launchmoxie,

    Glad you got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

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