Skip to content

Fix examples web smoke: ServeCompileCache constant mutation (#12040) - #12050

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-12040-serve-cache-constants
Jun 26, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-12040-serve-cache-constants

Conversation

@PurHur

@PurHur PurHur commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Root cause: ServeCompileCache reuses compiled Block instances across phpc serve requests, but Block::getFrame() placed compile-time constants into frame scope by reference. Builtins such as header() coerce arguments in place, so the cached literal for Content-Type: … became "" on the second request.
  • Symptom: DevServer::respond() wrote an empty extra header line (\r\n only), terminating HTTP headers early; Content-Length no longer matched the body and curl truncated responses (002-StaticWeb GET / missing World).
  • Fix: clone constant Variable cells per run via scopeConstantVariable(); ignore blank header() / extraHeaders lines defensively.

PHP implementation: lib/Block.php (scope setup), lib/Web/ResponseContext.php, lib/Web/DevServer.php.

Verification

./script/docker-exec.sh -- bash -lc './script/php-local.sh vendor/bin/phpunit test/unit/Web/ServeCompileCacheConstantsTest.php --no-configuration'
# OK (1 test, 6 assertions)

./script/docker-exec.sh -- bash -lc './script/examples-web-smoke.sh'
# examples-web-smoke: ok

./script/docker-exec.sh -- bash -lc './script/release-readiness.sh --full --json'  # spot-check examples-web-smoke gate

Closes #12040

Made with Cursor

Cached Block constants were shared by reference into frame scope; builtins
coerced them in place so the second phpc serve request queued an empty header
and truncated HTTP bodies. Clone constants per run and ignore blank header lines.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 3af3dc4 into master Jun 26, 2026
@PurHur
PurHur deleted the agent/issue-12040-serve-cache-constants branch June 26, 2026 09:57
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.

Release v1.1.0: fix examples web smoke regression (001-SimpleWeb serve readiness)

1 participant