WordPress.org

Ready to get started?Download WordPress

Forums

Genesis Simple Sidebars
[resolved] Erro: Illegal string offset (17 posts)

  1. onnoysomoy
    Member
    Posted 10 months ago #

    Hi,
    I am facing problem with Genesis simple sidebar plugin after upgrade. Please see below error code.

    Warning: Illegal string offset 'name' in /....../......../public_html/wp-content/plugins/genesis-simple-sidebars/plugin.php on line 105
    
    Warning: Illegal string offset 'description' in /....../....../public_html/wp-content/plugins/genesis-simple-sidebars/plugin.php on line 107

    What should I do? I have Latest Genesis Version and Custom Child Theme on site.

    Waiting to hear from you soon.

    http://wordpress.org/plugins/genesis-simple-sidebars/

  2. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 10 months ago #

    If you switch to the sample child theme do you still see those warning messages.

  3. onnoysomoy
    Member
    Posted 10 months ago #

    Hello Ron,
    Solved the problem after changing code a bit in line 105 & 107. See below.

    genesis_register_sidebar( array(
    			'name'        => esc_html( $info->name ),
    			'id'          => $id,
    			'description' => esc_html( $info->description ),
    			'editable'    => 1,
    		) );

    Dont need to switch theme. Thank you.

  4. Mike V
    Member
    Posted 9 months ago #

    I did this fix, and it solved the warnings, but now I don't see any titles on wp-admin/admin.php?page=simple-sidebars , the ID shows, but no Name or Description, they DO show up on the edit page. Everything else about the sidebars appears to be working as it should as far as I can tell. (php 5.4.20, Apache 2.4.6)

  5. Steve Borsch
    Member
    Posted 6 months ago #

    Bluehost upgraded PHP to 5.4.20 today (yes, one day before a MAJOR HOLIDAY) and maybe Apache. Took sites down all over their hosting but also impacted we dedicated server folks too.

    This error happened to me too. The fix worked too and sidebars appear as they did with the widgets assigned to them, but now cannot see sidebar names nor add/subtract widgets from any Simple Sidebars in wp-admin.

    Am not a php guy but I'm betting there is a new php array call that needs to be tweaked. Whaddya think Ron?

  6. Nick Ciske
    Member
    Posted 3 months ago #

    Here's what worked for me -- this code only attempts to register a sidebar if it has a name:

    if( isset( $info['name'] ) ){
    
    			genesis_register_sidebar( array(
    				'name'        => esc_html( $info['name'] ),
    				'id'          => $id,
    				'description' => esc_html( $info['description'] ),
    				'editable'    => 1,
    			) );
    
    		}
  7. Steve Borsch
    Member
    Posted 2 months ago #

    Nicely done Nick. Thanks!

    By the way, you are getting quite a rep on the MSP WordPress GGroup as Mr. Helpful and I know *I* really appreciate all of your contributions...and now here too?

    Guess I need to buy a Nick Ciske Action Figure. Know where I can get one? ;-)

  8. mrisdon
    Member
    Posted 2 months ago #

    Hey Guys,
    Hoping you can help. I barely know HTML and am trying to figure out what to change.

    Here's my code that I find in my genesis-simple-sidebars/plugin.php I searched the code to find what you guys had above:

    genesis_register_sidebar( array(
    'name' => esc_html( $info['name'] ),
    'id' => $id,
    'description' => esc_html( $info['description'] ),
    'editable' => 1,
    ) );

    I see in one post above the [ before 'name' & 'description' was changed to to ->

    But then that wasn't in the code Nick had. Any ideas what to do to make the errors for line 105 & 107 go away? Thanks!

  9. mrisdon
    Member
    Posted 2 months ago #

    So I emptied my cache. I update the code on the plugin and saved it, saw a new 3rd error, deleted it. Save the code. Now the errors are gone. So I'm guessing patience was the key? My site looks fine now. That was an odd one :)

  10. Nick Ciske
    Member
    Posted 2 months ago #

    PHP can treat objects as arrays, so: $info['name'] and $info->name could both work but it's best not to change the core code if you can help it.

    My code is based on the actual plugin code -- so use that and you should be fine ;-)

  11. beng7980
    Member
    Posted 2 months ago #

    I have just encountered the same problem and resolved immediately. Thanks Nick.

  12. pattyayers
    Member
    Posted 1 month ago #

    Nick, thank you for this, but could you clarify -- do you mean that I should replace this block of code (below) with your code? I did that, saved the plugin code, and cleared my cache. The sidebars disappeared from their screen in the Admin and from the Widgets screen. Any help on this would be much appreciated. PHP is not upgraded yet on my server, but will be in 6 days, and I'm using the plugin on a lot of websites.

    foreach ( (array) $_sidebars as $id => $info ) {
    
    		genesis_register_sidebar( array(
    			'name'        => esc_html( $info['name'] ),
    			'id'          => $id,
    			'description' => esc_html( $info['description'] ),
    			'editable'    => 1,
    		) );
    
    	}
  13. Nick Ciske
    Member
    Posted 1 month ago #

    Here's the modified plugin.php I'm using:
    https://gist.github.com/nciske/d5abe8b3903d08f9e71d

    Just replace the entire plugin.php file with that and you should be good to go.

    I'm seeing sidebars in the admin (Genesis: Simple Sidebars), the widgets screen, and the sidebar selector on pages/posts.

  14. pattyayers
    Member
    Posted 1 month ago #

    Thanks very much, Nick. But now I'm being told by StudioPress Support that the plugin has already been fixed, and that the problem is the ss-settings option in the database, which just needs to be deleted.

    Does it still make sense to overwrite the plugin code, when there will likely be updates on it going forward?

  15. Nick Ciske
    Member
    Posted 1 month ago #

    Just sharing what worked for me. What you do is up to you.

  16. pattyayers
    Member
    Posted 1 month ago #

    I understand. Thanks very much.

  17. gsacheli
    Member
    Posted 1 month ago #

    Super Nick :)
    everyday I discover something new! Today I was playing with NewRelict and I noticed a very high error rate, all of them with this message "Illegal string offset 'description'"... The website works fine and no warning in the admin page, but NewRelict...Some lurking and I found this page, I replaced the plugin.php file inside the plugin directory and the error rate drop to 0%... Amazing internet <3

    Thanks Nick

Reply

You must log in to post.

About this Plugin

About this Topic

Tags