You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Store the result cache with serialize() instead of a var_export'd PHP file
The result cache was written as a var_export'd PHP file and hydrated
with include. Including a multi-megabyte PHP source retains its
compiled op_arrays and interned strings for the process lifetime, and
building the var_export string concatenates the whole file in memory
on save. unserialize() produces only the values, and the retained
compiled-code cost disappears.
The errorsCallback/collectedDataCallback/exportedNodesCallback
closures existed to embed object graphs in the PHP file; restore()
invoked all of them unconditionally right after the include, so plain
arrays are equivalent.
A cache file in the old PHP format fails to unserialize and is
discarded like any other corrupted cache file (unlink and full
analysis). The serialized payload is prefixed with '<?php return; ?>'
so that an older PHPStan including the new-format file returns null
immediately instead of echoing megabytes of inline text to stdout,
and then discards it the same way. The format transition therefore
needs no cache version bump in either direction.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments