Support » Fixing WordPress » PHP Warning: Illegal string offset

  • Resolved largado

    (@largado)


    I installed a wordpress theme and I got this warning:

    Warning: Illegal string offset ‘name’ in C:\XAMPP\htdocs\wp2\wp-content\themes\lexiity\inc\theme-settings.php on line 12

    This is line 12:

    if(@$r3['value'] != '' && strlen($r3['name']) != 1 && $r3['type'] != 'select' && $r3['type'] != 'radio' && $r3['type'] != 'checkbox'){

    This is the entire function:

    function populate_theme_options(){ GLOBAL $tabs,$wp_version; $pages = @get_all_pages(); foreach ($tabs as $r1) { foreach ($r1 as $r2) { if (count($r2) > 0) { foreach ((array)$r2 as $r3) { if(@$r3['value'] != '' && strlen($r3['name']) != 1 && $r3['type'] != 'select' && $r3['type'] != 'radio' && $r3['type'] != 'checkbox'){ if ( version_compare( $wp_version, '3.4', '>=' ) ) {update_option(wp_get_theme().'_'.$r1['id'].'_'.$r3['name'], $r3['value']);}else{update_option(get_current_theme().'_'.$r1['id'].'_'.$r3['name'], $r3['value']);} } } } } } }

    Here is all the code in this php file:

    http://pastebin.com/6KdYVtXF

    How to remove this warning?

  • The topic ‘PHP Warning: Illegal string offset’ is closed to new replies.