Home > Enterprise >  Error PlanningExternalEvent.php on line 160
Error PlanningExternalEvent.php on line 160

Time:11-08

In GLP 10.0.3.

On the plan, I have this error:

Warning: strlen() expects parameter 1 to be string, array given in C:\wamp64\www\glpi\src\PlanningExternalEvent.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;

CodePudding user response:

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

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

To check your data

CodePudding user response:

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

  •  Tags:  
  • php
  • Related