{"record":{"id":"1d6d969040a1e631","repo":"PHPOffice/PhpSpreadsheet","slug":"value-1d6d96","errorCode":"#VALUE!","errorMessage":"#VALUE!","messagePattern":"#VALUE!","errorType":"exception","errorClass":"PhpOffice\\PhpSpreadsheet\\Calculation\\Exception","httpStatus":null,"severity":"error","filePath":"src/PhpSpreadsheet/Calculation/DateTimeExcel/Time.php","lineNumber":125,"sourceCode":"                $minute = 0;\n            }\n        } elseif ($minute >= 60) {\n            $hour += intdiv($minute, 60);\n            $minute = $minute % 60;\n        }\n    }\n\n    /**\n     * @param mixed $value expect int\n     */\n    private static function toIntWithNullBool(mixed $value): int\n    {\n        $value = $value ?? 0;\n        if (is_bool($value)) {\n            $value = (int) $value;\n        }\n        if (!is_numeric($value)) {\n            throw new Exception(ExcelError::VALUE());\n        }\n\n        return (int) $value;\n    }\n}\n","sourceCodeStart":107,"sourceCodeEnd":131,"githubUrl":"https://github.com/PHPOffice/PhpSpreadsheet/blob/65b080eef4d9fd11a5796135ab145883e5c3d6a6/src/PhpSpreadsheet/Calculation/DateTimeExcel/Time.php#L107-L131","documentation":"Table::setRange() (also invoked by the Table constructor) requires the range string to contain ':' - a table must span a rectangular range with a header row and data rows, not a single cell. Sheet qualifiers are stripped first via Worksheet::extractSheetTitle(), so 'Sheet1!A1' still reduces to the single cell 'A1' and throws. Passing '' does not throw: it silently clears the range and column rules.","triggerScenarios":"new Table('A1') or $table->setRange('D5'); ranges built from a single-cell AddressRange or from the string form of a one-cell selection; variables that collapse to one cell when start and end coincide.","commonSituations":"Dynamic ranges where the user's selection is a single cell; 'create table from selection' features that accept any selection; ranges derived from min/max that are equal for one row/column of data.","solutions":["Pass a real range: 'A1:E10' (a 1-column table like 'A1:A5' is fine - it contains ':')","When building dynamically, require at least two cells and widen or reject single-cell selections","Validate input early with str_contains($range, ':')"],"exampleFix":"// before\n$table = new Table('E5'); // single cell -> exception\n\n// after\n$table = new Table('E5:J20');","handlingStrategy":"validation","validationCode":"if (!str_contains($range, ':')) {\n    // single cell: widen to a minimal range or reject\n    $range = $range . ':' . $range; // still 1x1 but contains ':'; better: require >= 2 cells from the UI\n}\n$table->setRange($range);","typeGuard":"function isRangeString(string $range): bool\n{\n    return str_contains($range, ':');\n}","tryCatchPattern":"try {\n    $table->setRange($range);\n} catch (\\PhpOffice\\PhpSpreadsheet\\Exception $e) {\n    // single-cell or malformed range; re-prompt for a proper selection\n}","preventionTips":["Require a multi-cell selection in 'create table' UI flows","Compose range strings as $first . ':' . $last so they always contain ':'","Remember '' clears the table silently - do not use it to 'reset' when you meant to validate"],"tags":["table","range","single-cell","validation"],"backgroundTag":"invalid-range-format","analyzedSha":"65b080eef4d9fd11a5796135ab145883e5c3d6a6","analyzedAt":"2026-08-17T05:40:41.646Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}