Skip to content

Error Message: Invalid argument supplied for foreach() Filename: libraries/Fire_log.php #21

@Rajan1992

Description

@Rajan1992

Hi,
i want to use firelog but when i load the controller i get this error:
A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: libraries/Fire_log.php

Line Number: 111

Below is the code where error comes, in the libraries.
`public function list_files()
{
$list = get_dir_file_info( $this->log_path );
$filtered_list = array();

        foreach ($list as $file )
        {
            $file['attrs'] = '';
            $file['suffix'] = '';

            if( $file[ 'name' ] == $this->log_file )
            {
                $file['attrs'] = 'selected="selected"';
            }

            if( $file[ 'name' ] == $this->today )
            {
                $file[ 'suffix'] = ' - (' . $this->CI->lang->line( 'fire_log_today' ) . ')';
            }

            if( $file[ 'name' ] != 'index.html' )
            {
                array_push( $filtered_list, $file ); 
            }

        }
        //Order list by file name
        usort($filtered_list, create_function('$a, $b', 'return strcmp($b["name"], $a["name"]);'));

        return $filtered_list;
    }`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions