From a9e16d24fd9496bf516a14a538b56961fb7b218f Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Thu, 12 Nov 2026 02:02:19 +0000 Subject: [PATCH] Treat a lazy limit of zero as parsing everything up front A limit of zero was read as every field being over it, so every field, the id included, was set aside to be parsed later and the build failed. --- CHANGELOG.md | 6 ++++++ src/Flatpack.php | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8ac5a1..300b94e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixed + +- **`FLATPACK_LAZY_LIMIT=0` no longer stops the build.** The setting is documented as "parse everything up front", but a limit of zero was read as "every field is over the limit", so every field (the id and title included) was set aside to be parsed later and `flatpack:build` failed with `Unsupported operand types: array + null`. Zero now means what the config file says. + ## 1.2.1 (2026-11-11) ### Changed diff --git a/src/Flatpack.php b/src/Flatpack.php index 92abd2d..92f47d3 100644 --- a/src/Flatpack.php +++ b/src/Flatpack.php @@ -17,7 +17,8 @@ final class Flatpack public static function configure(string $path, int $lazyLimit = 2048): void { self::$path = rtrim($path, '/'); - self::$lazyLimit = $lazyLimit; + // Nothing is over a limit of zero or less, so it means "never": everything is parsed up front. + self::$lazyLimit = $lazyLimit > 0 ? $lazyLimit : PHP_INT_MAX; self::$bodies = null; }