Support » Networking WordPress » Networking site theme change bug: critical

  • Hello,

    My client has a network site and it has some weird bug involving changing themes:

    REPRO:
    https://imgur.com/a/T4MNJQY

    • A sub-site goes to “themes” to manage/change themes. (step 1)
    • Activating the other theme breaks the subsite. Codes (JSON?) screen of death is the only thing the subsite will see, even going to wp-admin. (step 2)
    • Weirdly, we don’t know what’s causing this, if it’s a plugin, or some file modification by one of our developer if it’s one of the themes, etc. One thing for sure is the following:
    • This bug happens only for subsite accounts (not the main accounts) changing themes.
    • It doesn’t matter which theme switched to the other. The problem is the switching
    • You can “review” the code and see if a fix can be found in there, but we actually have a way to recover the account (next step).
    • Now, to “fix the sub site” (please note, this step only applies to recovering the website from the code screen of death, not actually fix the switching problem) we found out that changing something in the settings help. Network Site > Sites > go to the [specificsubsite].domain.com > edit > settings (step 3)
    • We then look at the settings field called “Theme Switched” and remove the entry. (Step 4)

    Now the thing is, (like I said earlier), this only recovers a particular subsite. This does not fix the bug.

    Is anyone here capable of fixing it or has anyone experienced this and had a permanent fix?

    • This topic was modified 3 years, 4 months ago by MVertruger. Reason: missing step
    • This topic was modified 3 years, 4 months ago by MVertruger.
    • This topic was modified 3 years, 4 months ago by MVertruger. Reason: it's "theme switched" not "switched to"
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Does the problem happen when switching to a default twenty* theme as well? Are there any errors logged when switching fails? Check both server error logs and browser console.

    Try disabling all plugins, then try switching to a twenty* theme. If that works OK, but it failed during the twenty* switch test with all plugins active, reactivate plugins one by one, testing theme switching after each. When the problem recurs, the last activated plugin is at fault.

    Thread Starter MVertruger

    (@vmercader)

    Yes, the error happens on every theme switch. Even if I remove all other non-stock themes (and leave only twenty-* themes).

    What exact directory would be error logs of this type of bug be located?

    The best I can provide for a reference to the error is this code that comes to the page when errors appear:

    [/var/www/coach-sites/loader.php:31](#0) : {"level": "E_WARNING",
        "message": "array_search() expects parameter 2 to be array, null given",
        "file": "\/var\/www\/coach-sites\/public\/wp-includes\/widgets.php",
        "line": 1326,
        "line_string": "$active_key = array_search( $widget_id, $new_widgets, true );",
        "backtrace": [
            {"file": "\/wp-includes\/widgets.php",
                "line": 1326,
                "function": "array_search",
                "line_string": "$active_key = array_search( $widget_id, $new_widgets, true );",
                "args": [
                    "ac_contact_details-2",
                    null,
                    true]},
            {"file": "\/wp-includes\/widgets.php",
                "line": 1156,
                "function": "wp_map_sidebars_widgets",
                "line_string": "$sidebars_widgets = wp_map_sidebars_widgets( $sidebars_widgets );",
                "args": [
                    []]},
            {"file": "\/wp-includes\/widgets.php",
                "line": 1114,
                "function": "retrieve_widgets",
                "line_string": "retrieve_widgets(true);",
                "args": [
                    true]},
            {"file": "\/wp-includes\/class-wp-hook.php",
                "line": 288,
                "function": "_wp_sidebars_changed",
                "line_string": "$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int)$the_['accepted_args'] ) );",
                "args": [
                    "yourcoach"]},
            {"file": "\/wp-includes\/class-wp-hook.php",
                "line": 310,
                "class": "WP_Hook->",
                "function": "apply_filters",
                "line_string": "$this->apply_filters( '', $args );",
                "args": [
                    null,
                    ["yourcoach",
                        {"update": false}]]},
            {"file": "\/wp-includes\/plugin.php",
                "line": 453,
                "class": "WP_Hook->",
                "function": "do_action",
                "line_string": "$wp_filter[ $tag ]->do_action( $args );",
                "args": [
                    ["yourcoach",
                        {"update": false}]]},
            {"file": "\/wp-includes\/theme.php",
                "line": 2749,
                "function": "do_action",
                "line_string": "do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme );",
                "args": [
                    "after_switch_theme",
                    "yourcoach",
                    {"update": false}]},
            {"file": "\/wp-includes\/class-wp-hook.php",
                "line": 286,
                "function": "check_theme_switched",
                "line_string": "$value = call_user_func_array( $the_['function'], $args );",
                "args": [
                    ""]},
            {"file": "\/wp-includes\/class-wp-hook.php",
                "line": 310,
                "class": "WP_Hook->",
                "function": "apply_filters",
                "line_string": "$this->apply_filters( '', $args );",
                "args": [
                    null,
                    [""]]},
            {"file": "\/wp-includes\/plugin.php",
                "line": 453,
                "class": "WP_Hook->",
                "function": "do_action",
                "line_string": "$wp_filter[ $tag ]->do_action( $args );",
                "args": [
                    [""]]},
            {"file": "\/wp-settings.php",
                "line": 450,
                "function": "do_action",
                "line_string": "do_action( 'init' );",
                "args": [
                    "init"]},
            {"file": "\/wp-config.php",
                "line": 107,
                "function": "require_once",
                "line_string": "require_once(ABSPATH . 'wp-settings.php');\r",
                "args": [
                    "\/var\/www\/coach-sites\/public\/wp-settings.php"]},
            {"file": "\/wp-load.php",
                "line": 43,
                "function": "require_once",
                "line_string": "require_once( ABSPATH . 'wp-config.php' );",
                "args": [
                    "\/var\/www\/coach-sites\/public\/wp-config.php"]},
            {"file": "\/wp-admin\/admin.php",
                "line": 31,
                "function": "require_once",
                "line_string": "require_once(dirname(dirname(__FILE__)) . '\/wp-load.php');",
                "args": [
                    "\/var\/www\/coach-sites\/public\/wp-load.php"]},
            {"file": "\/wp-admin\/themes.php",
                "line": 10,
                "function": "require_once",
                "line_string": "require_once( dirname( __FILE__ ) . '\/admin.php' );",
                "args": [
                    "\/var\/www\/coach-sites\/public\/wp-admin\/admin.php"]}],
        "context": {
            "rid": "sEArfKRagM",
            "pid": 8421,
            "time": "2018-06-13T03:15:52.3853640+00:00",
            "$_SERVER": {
                "SERVER_SOFTWARE": "Apache\/2.4.18 (Ubuntu)",
                "REQUEST_URI": "\/wp-admin\/themes.php?activated=true",
                "HTTPS": "on",
                "SSL_TLS_SNI": "kevinstansfield.actioncoach.com",
                "HTTP_HOST": "kevinstansfield.actioncoach.com",
                "HTTP_CONNECTION": "keep-alive",
                "HTTP_UPGRADE_INSECURE_REQUESTS": "1",
                "HTTP_DNT": "1",
                "HTTP_USER_AGENT": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/67.0.3396.87 Safari\/537.36",
                "HTTP_ACCEPT": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
                "HTTP_REFERER": "https:\/\/kevinstansfield.actioncoach.com\/wp-admin\/themes.php",
                "HTTP_ACCEPT_ENCODING": "gzip, deflate, br",
                "HTTP_ACCEPT_LANGUAGE": "en-GB,en-US;q=0.9,en;q=0.8,zh-CN;q=0.7,zh;q=0.6,ja;q=0.5,fr;q=0.4",
                "HTTP_COOKIE": "wordpress_sec_a8726bd570f47aaa9e8db6a160c1d5ab=superaction%7C1529031530%7Cp8hgz7NhMKZOBcNc0cfsHPVmQrVdhlbMTnCW3Qi0nFl%7C38793c7c408220dfa904b1b1cdb58ff01be51335201402d893f72c7e95874945; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_a8726bd570f47aaa9e8db6a160c1d5ab=superaction%7C1529031530%7Cp8hgz7NhMKZOBcNc0cfsHPVmQrVdhlbMTnCW3Qi0nFl%7Cc314464f4cf980720caa63cfb1c48125056c6440bf1105e77dce70a3704a61fb; _ga=GA1.2.39112248.1528858784; _gid=GA1.2.1502254892.1528858784",
                "PATH": "\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin",
                "SERVER_SIGNATURE": "",
                "SERVER_NAME": "kevinstansfield.actioncoach.com",
                "SERVER_ADDR": "172.99.124.106",
                "SERVER_PORT": "443",
                "REMOTE_ADDR": "70.170.109.188",
                "DOCUMENT_ROOT": "\/var\/www\/coach-sites\/public",
                "REQUEST_SCHEME": "https",
                "CONTEXT_PREFIX": "",
                "CONTEXT_DOCUMENT_ROOT": "\/var\/www\/coach-sites\/public",
                "SERVER_ADMIN": "webmaster@localhost",
                "SCRIPT_FILENAME": "\/var\/www\/coach-sites\/public\/wp-admin\/themes.php",
                "REMOTE_PORT": "50230",
                "GATEWAY_INTERFACE": "CGI\/1.1",
                "SERVER_PROTOCOL": "HTTP\/1.1",
                "REQUEST_METHOD": "GET",
                "QUERY_STRING": "activated=true",
                "SCRIPT_NAME": "\/wp-admin\/themes.php",
                "PHP_SELF": "\/wp-admin\/themes.php",
                "REQUEST_TIME_FLOAT": "1528859752.361",
                "REQUEST_TIME": "1528859752"},
            "$_POST": [],
            "$_GET": {
                "activated": "true"}}}
    Moderator bcworkz

    (@bcworkz)

    Log file location is variable. In some cases you have to go through your hosting panel. The actual location is specified in php.ini, but you may not have access to this file.

    In any case, what you provided is fine. The problem here is the $new_widgets variable is undefined. Unfortunately, I’ve no idea how this would be possible, I’m unable to replicate the problem. The most likely explanation is a conflict among plugins. Do you experience this when all plugins are deactivated?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Networking site theme change bug: critical’ is closed to new replies.