• Resolved f3rr0

    (@f3rr0)


    This is relate to an old question (Error in Settings – Tab TEXT) that even if is marked as resolved it was not.

    Finally I got some extra time and found what caused the error, and also fixed it.

    The error appeared in SportsPress settings – Text and it was the following

    Warning: key() expects parameter 1 to be array, string given in /web/htdocs/www.basketbattaglia.com/home/wp-content/plugins/sportspress/includes/admin/class-sp-admin-settings.php on line 182

    Here’s a screenshot of the error

    After more investigation I’ve discovered that if any words contains special chars it raises the error. In my case was the Italian translation of Nationality, that is Nazionalità, and the function parsed it as follows

    Array
    (
        [sportspress_text_Nazionalit] => 
        [#224;]] => 
    )
    
    Warning: key() expects parameter 1 to be array, string given in /web/htdocs/www.basketbattaglia.com/home/wp-content/plugins/sportspress/includes/admin/class-sp-admin-settings.php on line 182

    My fix was this:
    Open
    wp-content/plugins/sportspress/includes/admin/class-sp-admin-settings.php

    find line 174
    parse_str( $option_name, $option_array );
    replace with
    parse_str( urlencode( $option_name ), $option_array );
    save the file.

    My error now is fixed

    • This topic was modified 5 years, 6 months ago by f3rr0.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator James Huff

    (@macmanx)

    Hi there @f3rr0 I see you reported this thread to the moderators. Please note that we are just the folks who enforce the rules around all of www.remarpro.com.

    Reporting to moderators doesn’t get any faster support, instead it just kind of attracts attention from folks whose radar you probably don’t want to be on. ??

    If you really do need a moderator, please add a reply letting us know why before you hit the report button.

    Otherwise, please hang in there for the plugin’s support to reply when they can.

    Thread Starter f3rr0

    (@f3rr0)

    I’m really sorry. I’ve clicked it by mistake. No moderation needed here. It’s just a proposal of how to fix an errori. Sorry again

    Thread Starter f3rr0

    (@f3rr0)

    However thinking on the fix I’ve changed it using html_entity_decode instead of urlencode ’cause no urls are used for those parameters so now my code for line 174 is
    parse_str( html_entity_decode( $option_name ), $option_array );

    Plugin Contributor Savvas

    (@savvasha)

    Hi @f3rr0 ,

    That was the solution I gave yesterday actually (https://github.com/ThemeBoy/SportsPress/commit/fbd4c21998bd2dbd7a690acf7fbe2232bec2c407) ??

    Hopefully it will be included in our next update also.

    Thanks again for the help!

    Savvas

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Warning: key() expects parameter 1 to be array, string given in ../settings/Text’ is closed to new replies.