Skip to content

BUG Error while reading indexed colors #52

@RyndychRD

Description

@RyndychRD

Using v3.0.1

In src/FastExcelReader/Excel.php, inside the _extractColor function, there is the following code:

if (!isset(self::INDEXED_COLORS[$indexed])) {
    return '#' . substr(self::INDEXED_COLORS[$indexed], 2);
}

It seems the condition is inverted.

When self::INDEXED_COLORS[$indexed] is not set, the code still tries to access it, which leads to a PHP array access warning/error.

I believe it should probably be:

if (isset(self::INDEXED_COLORS[$indexed])) {
    return '#' . substr(self::INDEXED_COLORS[$indexed], 2);
}

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