• jomo

    (@jonathanmoorebcsorg)


    Suprised to see this in the logs on latest version:

    
    PHP Fatal error:  Uncaught Error: Call to undefined function wp_cache_setting() in wp-content/plugins/wp-super-cache/wp-cache-phase1.php:988
    Stack trace:
    #0 wp-content/plugins/wp-super-cache/wp-cache-phase1.php(577): wpsc_create_debug_log('0c3689a829a7c7c...', '5015baad81dcbd8...')
    #1 wp-content/plugins/wp-super-cache/wp-cache-phase1.php(427): wp_cache_debug('wp_cache_get_co...', 5)
    #2 wp-content/plugins/wp-super-cache/wp-cache-phase1.php(120): wp_cache_get_cookies_values()
    #3 wp-content/plugins/wp-super-cache/wp-cache-phase1.php(126): get_wp_cache_key()
    #4 wp-content/plugins/wp-super-cache/wp-cache-phase1.php(157): wp_super_cache_init()
    #5 wp-content/plugins/wp-super-cache/wp-cache-phase1.php(383): wp_cache_serve_cache_file()
    #6 wp-content/advanced-cache.php(21): include_once('/home/...')
    #7  in wp-content/plugins/wp-super-cache/wp-cache-phase1.php on line 988
Viewing 12 replies - 1 through 12 (of 12 total)
  • I am having a similar issue. It started this afternoon.

    The error first appeared when I updated under construction plugin. I’ve now deactivated and removed it and deleted cache. In the admin area I get the error when I try to access certain admin areas.

    Thread Starter jomo

    (@jonathanmoorebcsorg)

    well that code path is only if debug logging is enabled, so you can just turn that off..

    Hi @jonathanmoorebcsorg,

    Stack trace shows that function wp_cache_setting is called before plugin is fully loaded. In this case it’s possible fatal error. You should replace code (wp-cache-phase1.php:988):

    wp_cache_setting( 'wp_cache_debug_log', $wp_cache_debug_log );
    wp_cache_setting( 'wp_cache_debug_username', $wp_cache_debug_username );
    

    with:

    if ( function_exists( 'wp_cache_setting' ) ) {
        wp_cache_setting( 'wp_cache_debug_log', $wp_cache_debug_log );
        wp_cache_setting( 'wp_cache_debug_username', $wp_cache_debug_username );
    }
    

    It’s quick workaround and probably it isn’t perfect. I see more issues related to debug logging and this code probably needs more improvements.

    Regards,
    Sasa

    Thread Starter jomo

    (@jonathanmoorebcsorg)

    Well yes I agree… another quick workaround is to turn the debug logging off 🙂

    I fixed the issue here. I’m going to merge this with the development version of the plugin shortly and it will stop the issue happening, while still allowing you to debug. 🙂

    The development version has been updated, so if this happens to you, give it a go by downloading it from the following page:

    https://odd.blog/y/2o

    I tried downloading a replacing all files as instructed in the link by @donncha and still had the same line 988 error.

    Tried turning off logging of debug.

    Still can’t even access my website- thehelpfulmarketer.com . Tried @stodorovic’s recommendation of replacing the code on line 988 and now I get this error:
    Parse error: syntax error, unexpected end of file in /home1/thehelt1/public_html/wp-content/plugins/wp-super-cache/wp-cache-phase1.php on line 1174

    Hi @abuzon

    I think that you forgot to put second ‘}’. I’ll copy here more lines to you can easy copy code:

            $fp = fopen( $cache_path . $wp_cache_debug_log, 'w' );
            if ( $fp ) {
                    fwrite( $fp, '<' . "?php\n" );
                    fwrite( $fp, $msg );
                    fwrite( $fp, '?' . "><pre>" . PHP_EOL );
                    fwrite( $fp, '<' . '?php // END HEADER ?' . '>' . PHP_EOL );
                    fclose( $fp );
                    if ( function_exists( 'wp_cache_setting' ) ) {
                            wp_cache_setting( 'wp_cache_debug_log', $wp_cache_debug_log );
                            wp_cache_setting( 'wp_cache_debug_username', $wp_cache_debug_username );
                    }  
            }
            $fp = fopen( $cache_path . 'view_' . $wp_cache_debug_log, 'w' );
    

    Just add if ( function_exists( 'wp_cache_setting' ) ) { before line 988 and } after line 990.

    I hope that helps,
    Sasa

    • This reply was modified 8 years, 6 months ago by Saša.

    Thank you @stodorovic you might be right!
    So I just did it again and I’m still getting the Fatal error on line 988.
    My website is totally down and I’m trying to win a client right now! This is SO BAD!
    I even tried deleting the plugin and was STILL getting this error even with a cleared browser cache. How is that possible??
    Any help is greatly appreciated!!

    Fatal error: Uncaught Error: Call to undefined function wp_cache_setting() in /home1/thehelt1/public_html/wp-content/plugins/wp-super-cache/wp-cache-phase1.php:988 Stack trace: #0 /home1/thehelt1/public_html/wp-content/plugins/wp-super-cache/wp-cache-phase1.php(577): wpsc_create_debug_log(‘5fcd10dcae042e8…’, ‘b7aff7fa19a2f89…’) #1 /home1/thehelt1/public_html/wp-content/plugins/wp-super-cache/wp-cache-phase1.php(427): wp_cache_debug(‘wp_cache_get_co…’, 5) #2 /home1/thehelt1/public_html/wp-content/plugins/wp-super-cache/wp-cache-phase1.php(51): wp_cache_get_cookies_values() #3 /home1/thehelt1/public_html/wp-content/advanced-cache.php(20): include_once(‘/home1/thehelt1…’) #4 /home1/thehelt1/public_html/wp-settings.php(84): include(‘/home1/thehelt1…’) #5 /home1/thehelt1/public_html/wp-config.php(84): require_once(‘/home1/thehelt1…’) #6 /home1/thehelt1/public_html/wp-load.php(37): require_once(‘/home1/thehelt1…’) #7 /home1/thehelt1/public_html/wp-blog-header.php(13): require_once(‘/home1/thehelt1…’) #8 /home1/t in /home1/thehelt1/public_html/wp-content/plugins/wp-super-cache/wp-cache-phase1.php on line 988

    Quick and fast solution is adding two lines from previous post.

    If you afraid to do it again, then it’s possible alternative solution, replacing lines 998 and 999:

    wp_cache_setting( 'wp_cache_debug_log', $wp_cache_debug_log );
    wp_cache_setting( 'wp_cache_debug_username', $wp_cache_debug_username );
    

    with

    function_exists( 'wp_cache_setting' ) && wp_cache_setting( 'wp_cache_debug_log', $wp_cache_debug_log );
    function_exists( 'wp_cache_setting' ) && wp_cache_setting( 'wp_cache_debug_username', $wp_cache_debug_username );
    

    If you want to remove plugin, then please follow these instructions after deactivation of plugin (You need FTP access):
    https://github.com/Automattic/wp-super-cache/wiki/In-An-Emergency

    I recommend to you just add function_exists( 'wp_cache_setting' ) && before wp_cache_setting at lines 998 and 999. It’s the fastest solution.

    • This reply was modified 8 years, 6 months ago by Saša.

    Thanks again @stodorovic
    I did just that. I quadruple checked the code when I did it the 2nd time and that error just was NOT going away. I finally just removed the plugin to get my site back up and installed a different caching plugin. 🙁 But my site is back up! 🙂

    The development version of the plugin has a fix for this. Grab it here:
    http://ocaoimh.ie/y/2o

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Call to undefined function wp_cache_setting()’ is closed to new replies.