WordPress.org

Forums

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

  1. onnoysomoy
    Member
    Posted 1 year 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 1 year ago #

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

  3. onnoysomoy
    Member
    Posted 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year ago #

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

  12. Patty J. Ayers
    Member
    Posted 1 year 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 year 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. Patty J. Ayers
    Member
    Posted 1 year 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 year ago #

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

  16. Patty J. Ayers
    Member
    Posted 1 year ago #

    I understand. Thanks very much.

  17. gsacheli
    Member
    Posted 1 year 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

  18. dni777
    Member
    Posted 11 months ago #

    Having the same issue.
    Tried replacing the code with what Nick posted above, to no avail.
    So I FTPed in and removed the plugin - but still getting this:

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

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

  19. dni777
    Member
    Posted 11 months ago #

    And to top it off, I can't get into my Admin area.

    Getting this error

    Warning: Cannot modify header information - headers already sent by (output started at /home/myservername/public_html/wp-content/plugins/genesis-simple-sidebars/plugin.php:105) in /home/myservername/public_html/wp-includes/pluggable.php on line 1121

  20. Nick Ciske
    Member
    Posted 11 months ago #

    I'm not sure you removed the plugin -- you can't get an error in a file that does’t exist ;-)

    I forked the plugin and fixed the errors, give this a try:
    https://github.com/nciske/genesis-simple-sidebars/tree/master

  21. dni777
    Member
    Posted 11 months ago #

    true that - there must be some cache going on that i don't remember putting in there ;-)
    have gone through all the other plugins and don't see one….but will keep fishing.
    thanks for the code will give that a try.

  22. Roger MacRae
    Member
    Posted 11 months ago #

    The problem still persists. The reason the problem persists is because the info array is empty and the newest version of php doesn't like that.

    The fix is simple and here it is:

    foreach ( (array) $_sidebars as $id => $info ) {
    	if (!is_array($info)) {
    		//do nothing
    	}
    		genesis_register_sidebar( array(
    			'name'        => esc_html( $info['name'] ),
    			'id'          => $id,
    			'description' => esc_html( $info['description'] ),
    			'editable'    => 1,
    		) );
            }
    	}

    at least that is what worked for me.

  23. westernwoman
    Member
    Posted 10 months ago #

    Ron are you going to update this plugin so that it works w/ new PHP and WP 3.92? That would be so great!!

    Many thanks,
    Western Woman

  24. bhull7
    Member
    Posted 10 months ago #

    The very last post on this page helped fix the error for me:

    http://wordpress.org/support/topic/error-after-updating-to-php-54

  25. mloewenberg
    Member
    Posted 9 months ago #

    i had this error this morning on inmotionhosting. i grabbed Nick Ciske's plugin.php file and replaced the one on my site and it's all fixed. Thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Genesis Simple Sidebars
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags