Skip to content

Treat a lazy limit of zero as parsing everything up front - #6

Merged
DanielDarrenJones merged 1 commit into
mainfrom
fix-lazy-limit-zero
Nov 12, 2026
Merged

DanielDarrenJones merged 1 commit into
mainfrom
fix-lazy-limit-zero

Conversation

@DanielDarrenJones

@DanielDarrenJones DanielDarrenJones commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

FLATPACK_LAZY_LIMIT=0 is documented in the config file as "parse everything up front", but it stopped flatpack:build:

Compiling content ... FAIL
TypeError: Unsupported operand types: array + null
at src/LeanYaml.php:34

Cause

A field is set aside to be parsed later when its size is over the limit. With a limit of zero every field is over it, the id and title included. Nothing was left to parse up front, the parser returned nothing, and the next line added an array to it.

So zero did the opposite of what the comment says. It has been like this since 1.0; the default of 2048 never reaches it.

Fix

Flatpack::configure() treats a limit of zero or less as no limit, which is the one place both checks read it from (Shallow::split() for files, EntryCodec for cached entries).

Checked

On the demo's 9,780-entry site with Statamic 6.41.0:

FLATPACK_LAZY_LIMIT Before After
0 build fails builds in 21 s and 779 MB, everything parsed
2048 (default) 14 s, 255 MB unchanged

Every entry and term URL matches Statamic's own Stache in both cases (12,840 compared). The parity suite passes on Statamic 6.

Reproduced on 6.40.0 and 6.41.0, so it isn't tied to a Statamic version.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

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.
@DanielDarrenJones
DanielDarrenJones merged commit c555b18 into main Nov 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant