Question: Error Opening The Admin Calendar

Error Opening The Admin Calendar

Dear friends, I receive the following error in the logs when opening the calendar, could you tell me how to solve it. ERROR - 2020-12-29 18:27:04 --> Severity: Warning --> Invalid argument

HR

Hector Rojas

Asked
Dear friends, I receive the following error in the logs when opening the calendar, could you tell me how to solve it.


ERROR - 2020-12-29 18:27:04 --> Severity: Warning --> Invalid argument supplied for foreach() C:\server\www\sma\app\controllers\admin\Calendar.php 128

128 -- foreach ($input_arrays as $array) {
129 -- $this->fc->load_event($array);
130 -- if ($this->fc->isWithinDayRange($start, $end)) {
131 -- $output_arrays[] = $this->fc->toArray();
132 -- }
133 -- }


Kind regards.
  • MS

    Mian Saleem

    Answered
    Hello,

    Please set the `ENVIRONMENT` to`production` in index.php as system don't check for the empty array.

    If you need to use it in development, you can add the foreach in if block as
    ```
    if (!empty($input_arrays)) {
    // foreach code block here
    }
    ```

    Thank you
  • HR

    Hector Rojas

    Answered
    Sorry, but the 'ENVIRONMENT' setting is in 'production'

    define ('ENVIRONMENT', 'production');


    Kind regards.
  • MS

    Mian Saleem

    Answered
    Those will gone away as you have data so you can ignore foreach loop errors. If you need you can add the if block as I mentioned in previous comment. I will check about this in future updated to have them inside if block or may be return empty array then false. Thank you
  • Login to Reply