PHPOffice/PhpSpreadsheet · error · PhpOffice\PhpSpreadsheet\Reader\Exception

Unsupported BIFF8 constant

Error message

Unsupported BIFF8 constant

What it means

When a formula's array constant (tArray / shared constant pool) is decoded, each element's type byte must be 0x01 (number), 0x02 (string), or 0x10 (error/boolean family handled above it). Anything else raises this ReaderException from Biff8::readBIFF8Constant.

Source

Thrown at src/PhpSpreadsheet/Reader/Xls/Biff8.php:96

                break;
            case 0x04: // boolean
                // offset: 1; size: 1; 0 = FALSE, 1 = TRUE
                if (ord($valueData[1])) {
                    $value = 'TRUE';
                } else {
                    $value = 'FALSE';
                }
                $size = 9;

                break;
            case 0x10: // error code
                // offset: 1; size: 1; error code
                $value = ErrorCode::lookup(ord($valueData[1]));
                $size = 9;

                break;
            default:
                throw new ReaderException('Unsupported BIFF8 constant');
        }

        return [
            'value' => $value,
            'size' => $size,
        ];
    }

    /**
     * Read BIFF8 cell range address list
     * section 2.5.15.
     *
     * @return array{size: int, cellRangeAddresses: mixed[]}
     */
    public static function readBIFF8CellRangeAddressList(string $subData): array
    {
        $cellRangeAddresses = [];

View on GitHub (pinned to 65b080eef4)

Solutions

  1. Open the workbook in Excel, re-enter the array formula normally, and re-save
  2. Convert to .xlsx via LibreOffice and read with the Xlsx reader
  3. Use setReadDataOnly(true) to bypass formula parsing when only cell values are required
Defensive patterns

Strategy: fallback

Try / catch

try {
    $spreadsheet = IOFactory::load($path);
} catch (\PhpOffice\PhpSpreadsheet\Reader\Exception $e) {
    if (str_contains($e->getMessage(), 'Unsupported BIFF8 constant')) {
        $reader = (new \PhpOffice\PhpSpreadsheet\Reader\Xls())->setReadDataOnly(true);
        $spreadsheet = $reader->load($path);
    }
}

Prevention

When it happens

Trigger: Corrupt array-constant bytes inside a FORMULA record, or a writer that emitted an element type the spec does not define (e.g. an experimental/newer constant type).

Common situations: Workbooks containing array formulas ({=...}) produced by third-party generators; files with bit-level damage; uploads processed by broken antivirus/rewrite proxies.

Related errors


AI-assisted analysis of PHPOffice/PhpSpreadsheet@65b080eef4 (2026-08-17). Data as JSON: /api/errors/5cbb149e53e0330b. Report an issue: GitHub.