Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator t-p

    (@t-p)

    Your best bet is to contact the author of that third-party script.

    Thread Starter thegreatest1

    (@thegreatest1)

    Im sorry it should be: Warning: Illegal string offset for ‘for_not_logged_in’ in /srv/…on line 5. This is line 5: if($atts[‘for_not_logged_in’] == “yes”) {

    Could I change this to make it work?

    it depends on how the code checks $atts if it’s empty I do what I have to do after that code initializes the array.
    example

    if(empty($atts)){
    //this code
    }

    if in any case the indexfor_not_logged_in is defined with yes or no
    This inizialized array
    $atts = array();

    $atts['indexfor_not_logged_in'] = 'yes';
    // For user without login
    $atts['indexfor_not_logged_in'] = 'no';
    // For user with login

    if it is not present in all cases, I initialize the array as in the previous code and add a verification of the existence of the index.

    if(!empty($atts['indexfor_not_logged_in']) && $atts['indexfor_not_logged_in'] == 'yes'){
    // Your code here
    }

    https://www.php.net/manual/en/language.types.array.php

    For multidimensional array $arr[‘a’][‘b’] or $arr[‘a’][‘c’]
    $arr = array('a' => array());

    the best way is to contact the developer that with php 7.1 => this problem exists 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Illeagal string offset’ is closed to new replies.