skip to Main Content

In GLP 10.0.3.

On the plan, I have this error:

Warning: strlen() expects parameter 1 to be string, array given in C:wamp64wwwglpisrcPlanningExternalEvent.php on line 160

My PlanningExternalEvent on line 160 :

        $is_rrule = strlen($this->fields['rrule']) > 0;

Can you help me ?
Thx

        $is_rrule = strlen($this->fields['rrule']) > 1;

2

Answers


  1. As the errors says the
    $this->fields['rrule']

    Is not string you can use
    var_dump($this->fields['rrule']);

    To check your data

    Login or Signup to reply.
  2. Your $this->fields['rrule'] is not a string but an array.

    If you’re expecting this, please type check before getting the str_len

    if(is_string($this->fields['rrule'])){
        $is_rrule = strlen($this->fields['rrule']) > 0;
    }else if(is_countable($this->fields['rrule'])){
        $is_rrule = count($this->fields['rrule']);
    }else{
        $is_rrule = false;
    }
    

    Alternatively, you can make sure that the field being set is in fact a string
    before passing it to the function/method

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search