Warning: Illegal string offset after moving files from local development to host (5 posts)

  1. JessiRue
    Posted 1 year ago #

    I have been working on a site locally and registered several new widget areas. (this is my first time attempting this). Everything work great on MAMP, but after moving to my host server to test and share with client I have gotten a HUGE string of errors beginning with Warning: Illegal string offset and a variety of descriptions
    ....to name a few.

    Oh, the widgets are showing up in the widgets admin, but not on the site. I am guessing the problem lies here somewhere. I'm still a newbie, hacking my way along... any ideas where, how to start troubleshooting this?!

    For what it is worth, the here is the site. http://mtsterling.printandpixelcreative.com/


  2. jrf
    Posted 1 year ago #

    Somewhere in the code, a string is being approached as an array which is causing the errors.

    Not sure if you write code yourself or just use code written by others, but basically some variable is needed around the code causing the errors.

    Can't tell you more than that without more specific information about the errors, i.e. file path and line numbers.

  3. JessiRue
    Posted 1 year ago #

    jrl - I'm thankful for your help and advice. I am learning to write the code, but stumbling a lot along the way and at times blindly following tutorials. I figure I written something wrong in the function without fully understanding it. Here is one of the complete warnings. All follow the same file path.

    Warning: Illegal string offset 'append_description_home' in /home/creative/public_html/mtsterling/wp-content/themes/genesis/lib/classes/sanitization.php on line 157

    Here is how I registered one of the widget and the function with it.
    genesis_register_sidebar( array(
    'id' => 'cta-chamber',
    'name' => __( 'Call to Action Chamber', 'msc' ),
    'description' => __( 'This is the call to action section.', 'msc' ),
    ) );

    // If it's the Chamber page, display CTA Chamber
    elseif ( is_page('about') ) {
    genesis_widget_area( 'cta-chamber', array(
    'before' => '<div id="cta"><div class="wrap">',
    'after' => '</div></div>',
    ) );

    Much thanks for any help. Or pointing in the right direction.

  4. JessiRue
    Posted 1 year ago #

    one last update.... I have stripped out all custom functions and removed all plugins - errors still exist on the 'live' site. The site still works beautifully on my local site running MAMP. I am feeling very crazy...

  5. jrf
    Posted 1 year ago #

    Ok, I'm not familiar with the Genesis functions, so can't give you much advise about those.

    The difference between your local server and the live site is probably due to a different error reporting setting.
    First thing to check: Have you got WP_DEBUG set to true in your wp-config.php file on both sites ?
    If so, leave it on true for the local site and set it to false for the live site.

    Secondly: if you still want to keep track of errors on the live site (and you should), don't use WP_DEBUG, but use this example code to set up error logging including a backtrace.

    As for the error, I kind of suspect that it's caused by the widget_area being added conditionally. Again, I'm not familiar with Genesis, but I think you might be better off taking the elseif ( is_page('about') ) {} wrapper out. Then in the actual widget display code, use the if ( is_page('about') ) {} wrapper around that.

    Quick tip: use backticks around code when you post here to make it more readable.

Topic Closed

This topic has been closed to new replies.

About this Topic