Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: utopia-php/http
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: utopia-php/http
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fix/route-immutable-matched-path
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 7 files changed
  • 2 contributors

Commits on Apr 23, 2026

  1. Make route matching immutable via RouteMatch value class

    The shared Route instance registered in Router::\$routes used to be
    mutated per-match via setMatchedPath(), plus self::\$wildcardRoute's
    path() was mutated per-request. Under coroutines those mutations race:
    aliased routes can see another request's matchedPath before getPathValues
    extracts params, and the wildcard's path leaked across concurrent
    requests.
    
    Introduce an immutable, request-scoped RouteMatch(route, matchedPath,
    resolvedPath) DTO returned by Router::match(). Http stores the current
    RouteMatch in the per-request DI container, reads matchedPath from there
    in execute(), and resolves the telemetry path without mutating the
    wildcard route. Route loses its matchedPath field and accessors.
    
    Bump utopia-php/di to ^0.3.2 so Container::set() invalidates resolved
    instances when overwriting a factory — without this, later re-sets of
    'routeMatch' within a request would be masked by the stale concrete
    cache.
    
    BC: Route::getMatchedPath() / setMatchedPath() removed; Router::match()
    now returns ?RouteMatch instead of ?Route.
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
    loks0n and claude committed Apr 23, 2026
    Configuration menu
    Copy the full SHA
    747e1d5 View commit details
    Browse the repository at this point in the history
Loading