• Resolved guess4me

    (@guess4me)


    Hello! My debug.log is full of these messages:

    PHP Warning: Redis::setex() expects parameter 2 to be int, string given in /var/www/public/zlata-studio.com.ua/wp-content/plugins/litespeed-cache/src/object-cache.cls.php on line 481

    $res = $this->_conn->setEx( $key, $ttl, $data );

    I’ve debugged it and it seems $ttl is equal to ‘et_get_main-menu’. My theme has following lines:

    
    function et_get_main_menu( $menu_id = 'main-menu', $class = '' ) {
            $custom_menu_slug = 'custom_nav';
            $cache_slug = 'et_get_' . $menu_id;
            if($menu_id == 'main-menu-right') $custom_menu_slug = 'custom_nav_right';
            $custom_menu = etheme_get_custom_field( $custom_menu_slug );
            $one_page_menu = '';
            if(etheme_get_custom_field('one_page')) $one_page_menu = ' one-page-menu';
            if(!empty($custom_menu) && $custom_menu != '') {
                $output = false;
                $output = wp_cache_get( $class, $custom_menu, $cache_slug );

    How could I fix this issue?

    • This topic was modified 4 years ago by guess4me.
    • This topic was modified 4 years ago by guess4me.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Hai Zheng?

    (@hailite)

    In your code snippet I didn’t see any wp_cache_set used. Can you paste the full error warning which can tell the full original file path that caused error, and the related snippet in your original file?

    Thread Starter guess4me

    (@guess4me)

        function et_get_main_menu( $menu_id = 'main-menu', $class = '' ) {
    
            $custom_menu_slug = 'custom_nav';
            $cache_slug = 'et_get_' . $menu_id;
            if($menu_id == 'main-menu-right') $custom_menu_slug = 'custom_nav_right';
            $custom_menu = etheme_get_custom_field( $custom_menu_slug );
            $one_page_menu = '';
            if(etheme_get_custom_field('one_page')) $one_page_menu = ' one-page-menu';
            if(!empty($custom_menu) && $custom_menu != '') {
                $output = false;
                $output = wp_cache_get( $class, $custom_menu, $cache_slug );
                if ( !$output ) {
                    ob_start();
    
                    wp_nav_menu(array(
                        'menu' => $custom_menu,
                        'before' => '',
                        'container_class' => 'menu-main-container' . $one_page_menu . $class,
                        'after' => '',
                        'link_before' => '',
                        'link_after' => '',
                        'depth' => 10,
                        'fallback_cb' => false,
                        'walker' => new Et_Navigation
                    ));
    
                    $output = ob_get_contents();
                    ob_end_clean();
    
                    wp_cache_add( $class, $custom_menu, $output, $cache_slug );
                }
    
                echo $output;
                return;
            }

    Yeah, it seems wp_cache_add uses wrong arguments.

    Plugin Support Hai Zheng?

    (@hailite)

    I think you have already had the answer. Better to ask ET dev. Thanks.

    svenms

    (@svenms)

    @guess4me is it your theme from 8theme? o Woopress Theme? I have similar issue.

    Best regards,

    Thread Starter guess4me

    (@guess4me)

    @svenms Yes, it is. Find lines like wp_cache_get( $class, $menu_id, $cache_slug ) at theme-functions.php & change it to wp_cache_get( “{$class}_{$menu_id}”, $cache_slug )

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Redis error’ is closed to new replies.