Skip to content

Web: PATH_INFO and front-controller routing ($_SERVER) #121

Description

@PurHur

Problem

Front controllers route on $_SERVER['PATH_INFO'] or parse REQUEST_URI:

$uri = $_SERVER['PATH_INFO'] ?? parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);

lib/Web/Superglobals.php sets REQUEST_URI and SCRIPT_NAME but not PATH_INFO consistently for bin/serve / CGI.

Goal

PATH_INFO populated when request is /index.php/foo/bar (common Apache/nginx + PHP-FPM pattern).

Implementation plan

  1. Extend Superglobals::populateServer() to derive PATH_INFO from REQUEST_URI minus SCRIPT_NAME.
  2. Web: CGI/1.1 request driver (stdin/stdout, env, Status line) #50 CGI driver: parse PATH_INFO env var when present.
  3. DevEx: bin/serve.php — local HTTP server for web development #88 serve.php: set PATH_INFO for pretty URLs.
  4. PHPT: GET with path suffix, assert routing string.

Acceptance criteria

  • test/real/cases/web_path_info.phpt passes VM
  • Document nginx try_files equivalent for AOT deploy

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions