Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ All notable changes to this package are in this file. The format follows

## [Unreleased]

### Changed

- The reference is FrankenPHP 1.14.0 with PHP 8.6.0. Its responses are the same as those of
1.13.6 with PHP 8.5.13; the suites compare them byte for byte.

## [1.1.0] - 2026-11-21

### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/Internal/Caddy.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use SorgeIt\HttpServer\Response;

/**
* The defaults and checks of Caddy 2.11.9 that FrankenPHP 1.13.6 serves with. Each names its place
* The defaults and checks of Caddy 2.11.9 that FrankenPHP 1.14.0 serves with. Each names its place
* in the source of Caddy, `modules/caddyhttp/`, so a new Caddy is compared place by place.
*
* @internal
Expand Down
28 changes: 14 additions & 14 deletions src/Internal/Php.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Throwable;

/**
* The SAPI of PHP 8.5.13 in FrankenPHP 1.13.6, with the php.ini of this process: what they do to
* The SAPI of PHP 8.6.0 in FrankenPHP 1.14.0, with the php.ini of this process: what they do to
* the response of a script that calls `header()` for each value, then `http_response_code()`,
* then echoes the body. Each rule names its place in the source.
*
Expand All @@ -27,14 +27,14 @@ final class Php

/**
* What `isspace()` of C finds; `sapi_header_op()` cuts it off the end of a header,
* main/SAPI.c:740.
* main/SAPI.c:712.
*/
private const string SPACE = " \t\n\r\v\f";

/**
* The ini of `INI` is read after the handler and its first chunk, as PHP sends the headers
* then. `zend_deactivate()` resets an ini the script set at the end of the request,
* main/main.c:2055; the server sets its own back after the handler and after each later chunk.
* main/main.c:2006; the server sets its own back after the handler and after each later chunk.
*
* @param Closure(Request): Response $handler
* @param Closure(Throwable): void $failed takes each throwable PHP turns into output
Expand Down Expand Up @@ -83,7 +83,7 @@ public static function failure(Throwable $throwable, Request $request): Response
/**
* @param array<string, string> $ini the values of `INI`, as `ini_get()` gives them
* @param bool $thrown a throw before any output: a status of 200 becomes 500 where
* `display_errors` is off, main/main.c:1541-1549
* `display_errors` is off, main/main.c:1494-1502
*/
public static function response(Response $response, Request $request, array $ini, bool $thrown = false): Response
{
Expand All @@ -101,7 +101,7 @@ public static function response(Response $response, Request $request, array $ini
$first = false;
$line = rtrim($name.': '.$value, self::SPACE);

// PHP refuses the header with a warning, main/SAPI.c:763.
// PHP refuses the header with a warning, main/SAPI.c:735.
if (strpbrk($line, "\r\n\0") !== false) {
continue;
}
Expand All @@ -115,7 +115,7 @@ public static function response(Response $response, Request $request, array $ini

$status = self::status($status, $key);

// `header()` replaces each header of the name, main/SAPI.c:666.
// `header()` replaces each header of the name, main/SAPI.c:638.
if ($replaces) {
$lines = array_filter($lines, static fn (string $kept): bool => strcasecmp((string) strstr($kept, ':', true), $key) !== 0);
}
Expand All @@ -126,7 +126,7 @@ public static function response(Response $response, Request $request, array $ini

$mimetype = $ini['default_mimetype'] ?? '';

// `sapi_send_headers()`, main/SAPI.c:878, and `get_default_content_type()`, 303.
// `sapi_send_headers()`, main/SAPI.c:850, and `get_default_content_type()`, 275.
if (! $typed && $mimetype !== '') {
$lines[] = 'Content-type: '.$mimetype.($charset !== '' && strncasecmp($mimetype, 'text/', 5) === 0 ? '; charset='.$charset : '');
}
Expand All @@ -153,7 +153,7 @@ public static function response(Response $response, Request $request, array $ini
return new Response($status, $headers, $response->body, $response->file, $response->deleteFile);
}

// For HEAD, PHP sends no output, main/output.c:121. The length of a file is a header of
// For HEAD, PHP sends no output, main/output.c:119. The length of a file is a header of
// the script.
if ($response->file !== null) {
$headers['Content-Length'] = [(string) filesize($response->file)];
Expand All @@ -178,9 +178,9 @@ private static function ini(): array
}

/**
* The status after a header, main/SAPI.c:834-852: `Location` gives 302 unless the status is
* The status after a header, main/SAPI.c:806-824: `Location` gives 302 unless the status is
* 201 or 3xx, and `WWW-Authenticate` 401. The 303 for a POST never comes: `sapi_activate()`
* sets the version to 1.0, main/SAPI.c:452, after cgi.go:464 set it, frankenphp.c:1951.
* sets the version to 1.0, main/SAPI.c:421, after cgi.go:464 set it, frankenphp.c:1959.
*/
private static function status(int $status, string $name): int
{
Expand Down Expand Up @@ -270,12 +270,12 @@ private static function restore(array $before): void

/**
* The fatal error of an uncaught throwable with `html_errors`, as `php_error_cb()` writes it,
* main/main.c:1497-1499, of the message of `zend_exception_error()`.
* main/main.c:1450-1452, of the message of `zend_exception_error()`.
*/
private static function page(Throwable $throwable): string
{
$message = 'Uncaught '.self::described($throwable)."\n thrown";
// `escape_html()`, main/main.c:1055: a second try replaces bytes the charset does not take.
// `escape_html()`, main/main.c:1060: a second try replaces bytes the charset does not take.
$escaped = htmlspecialchars($message, ENT_COMPAT);
$escaped = $escaped === '' ? htmlspecialchars($message, ENT_COMPAT | ENT_SUBSTITUTE) : $escaped;

Expand Down Expand Up @@ -311,7 +311,7 @@ private static function described(Throwable $throwable): string
}

/**
* The value as `php_get_display_errors_mode()` reads it, main/main.c:514: `stderr` writes to
* The value as `php_get_display_errors_mode()` reads it, main/main.c:517: `stderr` writes to
* the output too, as FrankenPHP is no CLI.
*/
private static function displays(string $value): bool
Expand All @@ -328,7 +328,7 @@ private static function bool(string $value): bool
}

/**
* `sapi_apply_default_charset()`, main/SAPI.c:369: a type that starts with `text/`, in that
* `sapi_apply_default_charset()`, main/SAPI.c:341: a type that starts with `text/`, in that
* case, and holds no `charset=` gets `default_charset`.
*/
private static function type(string $line, int $colon, string $charset): string
Expand Down
4 changes: 2 additions & 2 deletions tests/Fixtures/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Each directory keeps the license of its origin.
|---|---|---|
| `go-net-http/go/` | [golang/go](https://github.com/golang/go) at tag `go1.27.4` (commit `7b2881024c95a11ddb86663a616340aa3a88b67f`): the seven test files of `go-net-http/go.lock`, `VERSION` and `LICENSE`, byte for byte | BSD-3-Clause, see `go-net-http/go/LICENSE` |
| `go-net-http/cases.json` | The requests that `tests/GoNetHttp/extract` takes from the test files in `go-net-http/go/`, as file, line and test name, then probes of the rules in the other Go files of `go-net-http/go.lock`, as `probe` | BSD-3-Clause, see `go-net-http/go/LICENSE` |
| `caddy/cases.json`, `caddy/*.lock` | Probes of the rules in the files of Caddy that `caddy.lock` names with their blobs at tag `v2.11.9`; `caddy/frankenphp.lock` names the files of FrankenPHP `v1.13.6` that the layer of Caddy follows, with their blobs; no code of either | MIT, as this package |
| `caddy/cases.json`, `caddy/*.lock` | Probes of the rules in the files of Caddy that `caddy.lock` names with their blobs at tag `v2.11.9`; `caddy/frankenphp.lock` names the files of FrankenPHP `v1.14.0` that the layer of Caddy follows, with their blobs; no code of either | MIT, as this package |
| `chrome/*.req` | The bytes that Chrome for Testing 147, headless on macOS, sent to a page of a test, recorded by a proxy on 2026-11-12, one file for each of the 6 connections that carried bytes; the first carried none, so the files start at `conn-002`. They hold a navigation, CSS, JS, two images, two forms, `fetch`, XHR and a beacon with bodies of up to 1 MB, the methods `PUT`, `patch`, `DELETE`, `PROPFIND`, `HEAD` and `OPTIONS`, custom fields, one with bytes over 0x7F and one with the list value `1, 2`, two cookies, one with a value of 200 bytes, `Cache-Control: max-age=0`, `Range`, a CORS preflight, a WebSocket, an `EventSource`, a long path, and a path and a query with escapes | MIT, as this package |
| `frankenphp/cases.json`, `frankenphp/*.lock` | Cases of the rules in the files of FrankenPHP `v1.13.6` and PHP `php-8.5.13` that `frankenphp.lock` and `php-src.lock` name with their blobs, and the versions of the binaries in `release.lock`; no code of either | MIT, as this package |
| `frankenphp/cases.json`, `frankenphp/*.lock` | Cases of the rules in the files of FrankenPHP `v1.14.0` and PHP `php-8.6.0` that `frankenphp.lock` and `php-src.lock` name with their blobs, and the versions of the binaries in `release.lock`; no code of either | MIT, as this package |

`frankenphp/cases.json` holds for each case `name`, and as needed `ini` (the values that replace
those of `Cases::INI`), `method`, `protocol`, `status`, `headers` (a name and a list of values), one
Expand Down
6 changes: 3 additions & 3 deletions tests/Fixtures/caddy/frankenphp.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# The files of FrankenPHP the layer of Caddy follows, with their
# blobs at v1.13.6 (6775138789d2d0b834b6447cdc3e56b383fd651d), in the order of git ls-tree.
# blobs at v1.14.0 (30c6bb778ebbb56d7dceb939993160210fba01b2), in the order of git ls-tree.
# composer check:caddy fails when the newest release of FrankenPHP has other blobs.
abf1652411bda2367863af68928024e5303cb22f Dockerfile
acd80f61ff9df374a09533f7eaa8261767868be4 Dockerfile
093949a8efe7956ab5f699a4933b8246d533e5aa alpine.Dockerfile
cc9bd523fe1fe133e9f40e92e326551400ec481a caddy/frankenphp/Caddyfile
b978384faba830ebd1c77d5d943742e224fc10a0 caddy/module.go
aefa2cf2ce8fe30ba9e5c6eeeab2823390317d4a caddy/module.go
bd5fb4da7675f0e74d95ef04031ac6e1c6ba415b caddy/php-server.go
6 changes: 3 additions & 3 deletions tests/Fixtures/frankenphp/frankenphp.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The files of FrankenPHP that src/Internal/Php.php follows, with their blobs at v1.13.6
# (6775138789d2d0b834b6447cdc3e56b383fd651d), in the order of git ls-tree.
# The files of FrankenPHP that src/Internal/Php.php follows, with their blobs at v1.14.0
# (30c6bb778ebbb56d7dceb939993160210fba01b2), in the order of git ls-tree.
# composer check:frankenphp fails when the newest release of FrankenPHP has other blobs.
356b1a4f63e43a9437e26c1761e8630c44b2d39c cgi.go
8fdd5750f8b83d6e5ae8d373ed149cb23b29ce5f frankenphp.c
8783c18ec8f0744beb04a3bebd9dd321c3926354 frankenphp.c
7c5170d3a7735266fc92c1ddf53a9805b24a4c2c frankenphp.go
12 changes: 6 additions & 6 deletions tests/Fixtures/frankenphp/php-src.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The files of PHP that src/Internal/Php.php follows, with their blobs at php-8.5.13
# (46bcb661df53d9ded93fef239e15707bf7cea2e9), the PHP of FrankenPHP v1.13.6, in the order of git
# The files of PHP that src/Internal/Php.php follows, with their blobs at php-8.6.0
# (8aaada3f9605d81a38b8240f93c7389dfbc77ef9), the PHP of FrankenPHP v1.14.0, in the order of git
# ls-tree. composer check:frankenphp fails when the PHP of the newest FrankenPHP has other blobs.
62145077676bf327063bf74596dff44630275262 ext/standard/head.c
5c64a194644494ce87d88ee425c8c8817eac861f main/SAPI.c
101406fb63a70d5e2ec48162e91e6a353ae40709 main/main.c
32de70862c2d843745763464ad7ba4955b5b10d8 main/output.c
2d7197488a81e4ba18d75d4364518ae8d3c4a7d4 ext/standard/head.c
d43adfeac45548c873d6fbde537fb5bce6cbc109 main/SAPI.c
1403ad93c5c81084ffdd1fe8876fcfbd9372b2e3 main/main.c
b717d3d84ada86a704c0e8e240d25c715d8aa4d6 main/output.c
2 changes: 1 addition & 1 deletion tests/Fixtures/frankenphp/release.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The versions that the binary of composer frankenphp:install names. composer check:frankenphp
# compares them with the newest release. composer frankenphp:lock writes new versions after a check
# of the attestation of each binary.
FrankenPHP v1.13.6 PHP 8.5.13 Caddy v2.11.9
FrankenPHP v1.14.0 PHP 8.6.0 Caddy v2.11.9
2 changes: 1 addition & 1 deletion tests/FrankenPhp/FrankenPhpReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function answers(string $bytes, Limits $limits, ?float $within = null): s
}

/**
* The first lines of the version of the binary, such as `FrankenPHP v1.13.6 PHP 8.5.13 ...`.
* The first lines of the version of the binary, such as `FrankenPHP v1.14.0 PHP 8.6.0 ...`.
*/
public function version(): string
{
Expand Down
14 changes: 7 additions & 7 deletions tests/FrankenPhp/FrankenPhpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,18 @@ function frankenPhpCases(): array
it('names in each place the FrankenPHP of release.lock and its PHP', function (): void {
$version = strtok((string) preg_replace('/^#.*\n/m', '', (string) file_get_contents(FRANKENPHP_FIXTURE.'/release.lock')), "\n");

expect($version)->toBe('FrankenPHP v1.13.6 PHP 8.5.13 Caddy v2.11.9')
expect($version)->toBe('FrankenPHP v1.14.0 PHP 8.6.0 Caddy v2.11.9')
->and(FrankenPhpReference::get()->version())->toStartWith($version.' ')
->and(file_get_contents(FRANKENPHP_FIXTURE.'/frankenphp.lock'))->toContain('blobs at v1.13.6')
->and(file_get_contents(FRANKENPHP_FIXTURE.'/php-src.lock'))->toContain('blobs at php-8.5.13')
->and(file_get_contents(__DIR__.'/../../src/Internal/Php.php'))->toContain('PHP 8.5.13 in FrankenPHP 1.13.6')
->and(file_get_contents(FRANKENPHP_FIXTURE.'/frankenphp.lock'))->toContain('blobs at v1.14.0')
->and(file_get_contents(FRANKENPHP_FIXTURE.'/php-src.lock'))->toContain('blobs at php-8.6.0')
->and(file_get_contents(__DIR__.'/../../src/Internal/Php.php'))->toContain('PHP 8.6.0 in FrankenPHP 1.14.0')
->and(file_get_contents(CADDY_FIXTURE.'/caddy.lock'))->toContain('blobs at v2.11.9 (')
->and(file_get_contents(CADDY_FIXTURE.'/frankenphp.lock'))->toContain('blobs at v1.13.6 (')
->and(file_get_contents(__DIR__.'/../../src/Internal/Caddy.php'))->toContain('Caddy 2.11.9 ')->toContain('FrankenPHP 1.13.6 ');
->and(file_get_contents(CADDY_FIXTURE.'/frankenphp.lock'))->toContain('blobs at v1.14.0 (')
->and(file_get_contents(__DIR__.'/../../src/Internal/Caddy.php'))->toContain('Caddy 2.11.9 ')->toContain('FrankenPHP 1.14.0 ');
})->group('pins');

// The suites give FrankenPHP the `maxHead` of the server, so this test alone sees the default of
// Caddy. With a `max_header_size` of 16 KB, FrankenPHP 1.13.6 takes a head of 20494 bytes and
// Caddy. With a `max_header_size` of 16 KB, FrankenPHP 1.14.0 takes a head of 20494 bytes and
// refuses one byte more: Go reads 4096 bytes more, net/http/server.go:957.
it('has the MaxHeaderBytes of Caddy::MAX_HEADER_BYTES in FrankenPHP without max_header_size', function (): void {
$status = static function (int $length, bool $set): string {
Expand Down
8 changes: 4 additions & 4 deletions tests/FrankenPhp/Release.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static function system(): string
}

/**
* The versions of release.lock, such as `FrankenPHP v1.13.6 PHP 8.5.13 Caddy v2.11.9`.
* The versions of release.lock, such as `FrankenPHP v1.14.0 PHP 8.6.0 Caddy v2.11.9`.
*/
public static function version(): string
{
Expand All @@ -44,7 +44,7 @@ public static function version(): string
}

/**
* The tag of the release in the versions, such as `v1.13.6`.
* The tag of the release in the versions, such as `v1.14.0`.
*/
public static function tag(string $version): string
{
Expand All @@ -58,7 +58,7 @@ public static function versionOf(string $binary): string
{
exec(escapeshellarg($binary).' version 2>&1', $output, $status);

// Such as `FrankenPHP v1.13.6 PHP 8.5.13 Caddy v2.11.9 h1:…`.
// Such as `FrankenPHP v1.14.0 PHP 8.6.0 Caddy v2.11.9 h1:…`.
if ($status !== 0 || preg_match('/^FrankenPHP \S+ PHP \S+ Caddy \S+/', implode("\n", $output), $match) !== 1) {
throw new RuntimeException($binary.' names no versions: '.implode("\n", $output));
}
Expand Down Expand Up @@ -118,7 +118,7 @@ public static function digests(string $version): array
}

/**
* The tag of the newest release, such as `v1.13.6`. Not the newest tag: upstream tags a version
* The tag of the newest release, such as `v1.14.0`. Not the newest tag: upstream tags a version
* and publishes its release hours later.
*/
public static function newest(): string
Expand Down
Loading