Repository navigation
Pre-release 4.2.120 → 4.2.119 — task 4.5: cookies and sessions as global middleware, StackPHP layer removed - #93
Merged
Merged
Conversation
agissept
force-pushed
the
pre-release/4.2.120
branch
from
October 2, 2026 09:20
14026a7 to
89c5996
Compare
agissept
marked this pull request as ready for review
October 5, 2026 06:14
…un as global middleware (task 4.5) The fork wrapped every request in StackPHP HttpKernelInterface layers (cookie Guard, cookie Queue, session Middleware, plus the app's $app->middleware() classes), built by MiddlewareBuilder around handle(). v13 has no StackPHP: those jobs are middleware in the Kernel's stack (EncryptCookies, AddQueuedCookiesToResponse, StartSession). The app now lists them in its global middleware, so the fork drops the layer: - run() handles the request, sends the response and terminates, like v13's Kernel; getStackedClient(), middleware(), forgetMiddleware(), useArraySessions() and registerBaseMiddlewares() are removed; - MiddlewareBuilder, StackedHttpKernel and the fork-only Cookie\Guard, Cookie\Queue, Session\Middleware and Http\FrameGuard are deleted. With the session and cookie middleware inside the global stack, an exception must become a response before it unwinds through them, or the session is not saved on an error page (e.g. the expired-session redirect's flash). The global pipeline now renders an exception at the stage that threw it, through the fork Handler, as v13's Routing\Pipeline does with the bound ExceptionHandler. Under unit tests, or with $catch = false, it still rethrows. Fork suite 265 green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169SsatCE8LhaTsQTPiGtVo
v13's AddQueuedCookiesToResponse takes Contracts\Cookie\QueueingFactory, which v13's Application aliases to 'cookie' together with Contracts\Cookie\Factory. Add the same aliases so the app can run it in its global middleware. Fork suite 266 green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169SsatCE8LhaTsQTPiGtVo
agissept
force-pushed
the
pre-release/4.2.120
branch
from
October 5, 2026 06:14
89c5996 to
0dcdbea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task 4.5, middleware — the StackPHP layer goes; cookies and sessions run as global middleware
Stacks on #92.
Application::run()wrappedhandle()in a StackPHP kernel: the cookieGuardandQueue, the sessionMiddleware, and whatever the app pushed withApp::middleware(). Laravel 13 has no such layer. Cookies and sessions are ordinary global middleware there (EncryptCookies,AddQueuedCookiesToResponse,StartSession). This release removes the layer, and the dicoding app pair lists those v13 middleware in its global stack.Changes
Application::run()sendshandle()'s response and callsterminate(). No stacked client is built.Application::dispatch()runs the global middleware through a pipeline that renders an exception at the stage that threw it, as v13'sRouting\Pipelinedoes:TokenMismatchredirect, keeps the session and its cookie.$catch = false, the exception still reaches the caller.Application:middleware(),forgetMiddleware(),useArraySessions(),getStackedClient(),mergeCustomMiddlewares()andregisterBaseMiddlewares().cookiebinding is aliased toIlluminate\Contracts\Cookie\FactoryandQueueingFactory. v13'sAddQueuedCookiesToResponseresolves the jar by those contracts.Cookie\Guard,Cookie\QueueandSession\Middleware;Foundation\Http\MiddlewareBuilderandStackedHttpKernel;Http\FrameGuard, which was opt-in and never registered by the app;CookieandHttpcomponentcomposer.jsonfiles, since nothing is left in either directory.FoundationGlobalMiddlewareTestadds five cases:run()sends the handled response and calls the terminating callbacks;FoundationApplicationTestdropstestForgetMiddlewareand checks that the cookie jar resolves through its contracts.Verification
feature/platform/framework-4.2.120-rc1). It lists the v13 cookie and session middleware in the app's global stack, and keeps the fork's cookie format so a rollback still reads every cookie. It ran with vendor installed exactly from its lock:StartSessionnow switches the driver for that request only.Tag
4.2.120(14026a74) is not pushed, and neither is4.2.119(c95ae41d). Tag pushes are refused for this session.🤖 Generated with Claude Code
https://claude.ai/code/session_0169SsatCE8LhaTsQTPiGtVo