WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Widgets problem (8 posts)

  1. Sparkblog
    Member
    Posted 4 years ago #

    my website, using the "mystique" theme has had some issues for a long while now, something i am not familliar with at all, and i was wondering wether anyone could tell me what the following means?

    Fatal error: Nesting level too deep - recursive dependency? in /mnt/w1009/d42/s05/b02dc22a/www/bunglist.com/sparkblog/wp-includes/widgets.php on line 924

    any ideas?
    thanks
    SparkBlog

  2. bunglist
    Member
    Posted 4 years ago #

    The problem is in widgets.php

    function is_active_widget($callback = false, $widget_id = false, $id_base = false, $skip_inactive = true) {
    	global $wp_registered_widgets;
    
    	$sidebars_widgets = wp_get_sidebars_widgets();
    
    	if ( is_array($sidebars_widgets) ) {
    		foreach ( $sidebars_widgets as $sidebar => $widgets ) {
    			if ( $skip_inactive && 'wp_inactive_widgets' == $sidebar )
    				continue;
    
    			if ( is_array($widgets) ) {
    				foreach ( $widgets as $widget ) {
    					if ( ( $callback && isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback ) || ( $id_base && _get_widget_id_base($widget) == $id_base ) ) {
    						if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] )
    							return $sidebar;
    					}
    				}
    			}
    		}
    	}
    	return false;
    }

    Original:
    Line 924-925 (widgets.php):

    if ( ( $callback && isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback ) || ( $id_base && _get_widget_id_base($widget) == $id_base ) ) {
        if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] )

    From what this guy said about the "Nesting level too deep - recursive dependency" error I switched the comparison operators in the if statements (lines 924 and 925) from non-strict (==) to strict (===) and it reduces the amount of objects being checked to those of the same type, so all of the widgets now show up in widgets.php and no more error.

    Fix:
    Line 924-925 (widgets.php):
    Replace the three non-strict comparison operators (==) with strict (===).
    Third replacement, line 925, may not be necessary

    if ( ( $callback && isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] === $callback ) || ( $id_base && _get_widget_id_base($widget) === $id_base ) ) {
        if ( !$widget_id || $widget_id === $wp_registered_widgets[$widget]['id'] )
  3. Sparkblog
    Member
    Posted 4 years ago #

    Thanks bung, all fixed and ready to go :D

  4. currye
    Member
    Posted 4 years ago #

    My widgets are stuck and I downloaded widgets reset they are still I change themes, deactived all plugins and actived another theme and I get this message. Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/bah/bahbah/bahbah/wp-includes/widgets.php on line 852

    This is whats on that line 852:
    if ( empty($wp_registered_sidebars[$index]) || !array_key_exists($index, $sidebars_widgets) || !is_array($sidebars_widgets[$index]) || empty($sidebars_widgets[$index]) )
    return false;

  5. dreamgenius
    Member
    Posted 3 years ago #

    I have a customer using the Flexx Professional 2.7.8 theme on WordPress 2.9.2 who is experiencing the same problem as the original poster but replacing == with === in lines 925 and 926 has failed to have any effect.

    Can anyone suggest any other method of getting this working again? She'd rather not upgrade the WordPress installation to 3.0.1 as this will break other Plugins that she relies on which have not yet been upgraded.

    I'm stumped and, as a result of changing themes to test the problem, the website is currently broken. I'd like to get it working for her again as soon as possible.

  6. anusethu
    Member
    Posted 3 years ago #

    Hello,
    our website is http://www.churchfieldsjunior.com The widgets have moved down and not in position. I have tried many forums and have not received any answers. Please could someone tell me what I should do as I am a novice and not experienced in any php???
    Many thanks

  7. duca
    Member
    Posted 3 years ago #

    Anusethu, maybe you have the widget in to the "footer", reset it to "default sidebar".

  8. anusethu
    Member
    Posted 3 years ago #

    Thanks Duca,
    I have managed to sort it. I validated the code and fixed the errors and it has sorted the issue.
    Many thanks for your help.
    Anusethu

Topic Closed

This topic has been closed to new replies.

About this Topic