From d712aed2a53ec0a9b55a5b665ce322d227c7a5ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sun, 19 Jan 2025 23:41:10 +0100 Subject: [PATCH 1/3] chore: prepare release 1.4.1 --- caddy/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caddy/go.mod b/caddy/go.mod index 402f2047b..accf76b5c 100644 --- a/caddy/go.mod +++ b/caddy/go.mod @@ -10,7 +10,7 @@ require ( github.com/caddyserver/caddy/v2 v2.9.1 github.com/caddyserver/certmagic v0.21.6 github.com/dunglas/caddy-cbrotli v1.0.0 - github.com/dunglas/frankenphp v1.4.0 + github.com/dunglas/frankenphp v1.4.1 github.com/dunglas/mercure/caddy v0.18.1 github.com/dunglas/vulcain/caddy v1.1.1 github.com/prometheus/client_golang v1.20.5 From 2f4c8310e241b55d776ecc78909d7dd000616b26 Mon Sep 17 00:00:00 2001 From: Alexander Stecher <45872305+AlliBalliBaba@users.noreply.github.com> Date: Mon, 20 Jan 2025 18:45:00 +0100 Subject: [PATCH 2/3] fix - flushing temporary files after each worker request (#1321) * Removes temporary fix and flushes files on each request. --- frankenphp.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/frankenphp.c b/frankenphp.c index ee20cd45b..2281fc98a 100644 --- a/frankenphp.c +++ b/frankenphp.c @@ -135,9 +135,6 @@ static void frankenphp_worker_request_shutdown() { zend_end_try(); zend_set_memory_limit(PG(memory_limit)); - /* TODO: remove next line when https://github.com/php/php-src/pull/14499 will - * be available */ - SG(rfc1867_uploaded_files) = NULL; } PHPAPI void get_full_env(zval *track_vars_array) { From ece420c569f906f765de0d1cc23c91e924cb41aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Tue, 21 Jan 2025 00:32:52 +0100 Subject: [PATCH 3/3] chore: fix typos (#1328) * Fix typos * Fix indentation --- caddy/caddy_test.go | 2 +- docs/config.md | 2 +- docs/production.md | 2 +- frankenphp.c | 2 +- frankenphp_test.go | 14 +++++++------- watcher_test.go | 4 ++-- worker_test.go | 8 ++++---- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/caddy/caddy_test.go b/caddy/caddy_test.go index 7c512b018..71880fb5a 100644 --- a/caddy/caddy_test.go +++ b/caddy/caddy_test.go @@ -608,7 +608,7 @@ func TestAllDefinedServerVars(t *testing.T) { "Content-Type: application/x-www-form-urlencoded", "Content-Length: 14", // maliciously set to 14 "Special-Chars: <%00>", - "Host: Malicous Host", + "Host: Malicious Host", "X-Empty-Header:", }, bytes.NewBufferString("foo=bar"), diff --git a/docs/config.md b/docs/config.md index 6bce7f9ec..07034aefe 100644 --- a/docs/config.md +++ b/docs/config.md @@ -19,7 +19,7 @@ FROM dunglas/frankenphp # Production: RUN cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini -# Or developement: +# Or development: RUN cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini ``` diff --git a/docs/production.md b/docs/production.md index 6817c30e2..81a636e81 100644 --- a/docs/production.md +++ b/docs/production.md @@ -31,7 +31,7 @@ Refer to "[Building Custom Docker Image](docker.md)" for more details and option and to learn how to customize the configuration, install PHP extensions and Caddy modules. If your project uses Composer, -be sure to include it in the Docker image and to install your depedencies. +be sure to include it in the Docker image and to install your dependencies. Then, add a `compose.yaml` file: diff --git a/frankenphp.c b/frankenphp.c index 2281fc98a..d7cfe5b33 100644 --- a/frankenphp.c +++ b/frankenphp.c @@ -431,7 +431,7 @@ PHP_FUNCTION(frankenphp_handle_request) { } /* - * If an exception occured, print the message to the client before closing the + * If an exception occurred, print the message to the client before closing the * connection */ if (EG(exception)) { diff --git a/frankenphp_test.go b/frankenphp_test.go index fd23be5e7..086da14ce 100644 --- a/frankenphp_test.go +++ b/frankenphp_test.go @@ -1,6 +1,6 @@ // In all tests, headers added to requests are copied on the heap using strings.Clone. // This was originally a workaround for https://github.com/golang/go/issues/65286#issuecomment-1920087884 (fixed in Go 1.22), -// but this allows to catch panics occuring in real life but not when the string is in the internal binary memory. +// but this allows to catch panics occurring in real life but not when the string is in the internal binary memory. package frankenphp_test @@ -41,7 +41,7 @@ type testOptions struct { watch []string nbWorkers int env map[string]string - nbParrallelRequests int + nbParallelRequests int realServer bool logger *zap.Logger initOpts []frankenphp.Option @@ -51,8 +51,8 @@ func runTest(t *testing.T, test func(func(http.ResponseWriter, *http.Request), * if opts == nil { opts = &testOptions{} } - if opts.nbParrallelRequests == 0 { - opts.nbParrallelRequests = 100 + if opts.nbParallelRequests == 0 { + opts.nbParallelRequests = 100 } cwd, _ := os.Getwd() @@ -87,8 +87,8 @@ func runTest(t *testing.T, test func(func(http.ResponseWriter, *http.Request), * } var wg sync.WaitGroup - wg.Add(opts.nbParrallelRequests) - for i := 0; i < opts.nbParrallelRequests; i++ { + wg.Add(opts.nbParallelRequests) + for i := 0; i < opts.nbParallelRequests; i++ { go func(i int) { test(handler, ts, i) wg.Done() @@ -850,7 +850,7 @@ func BenchmarkServerSuperGlobal(b *testing.B) { cwd, _ := os.Getwd() testDataDir := cwd + "/testdata/" - // Mimicks headers of a request sent by Firefox to GitHub + // Mimics headers of a request sent by Firefox to GitHub headers := http.Header{} headers.Add(strings.Clone("Accept"), strings.Clone("text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")) headers.Add(strings.Clone("Accept-Encoding"), strings.Clone("gzip, deflate, br")) diff --git a/watcher_test.go b/watcher_test.go index 7f46b4b90..43facfeda 100644 --- a/watcher_test.go +++ b/watcher_test.go @@ -29,7 +29,7 @@ func TestWorkersShouldReloadOnMatchingPattern(t *testing.T) { runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) { requestBodyHasReset := pollForWorkerReset(t, handler, maxTimesToPollForChanges) assert.True(t, requestBodyHasReset) - }, &testOptions{nbParrallelRequests: 1, nbWorkers: 1, workerScript: "worker-with-watcher.php", watch: watch}) + }, &testOptions{nbParallelRequests: 1, nbWorkers: 1, workerScript: "worker-with-watcher.php", watch: watch}) } func TestWorkersShouldNotReloadOnExcludingPattern(t *testing.T) { @@ -38,7 +38,7 @@ func TestWorkersShouldNotReloadOnExcludingPattern(t *testing.T) { runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) { requestBodyHasReset := pollForWorkerReset(t, handler, minTimesToPollForChanges) assert.False(t, requestBodyHasReset) - }, &testOptions{nbParrallelRequests: 1, nbWorkers: 1, workerScript: "worker-with-watcher.php", watch: watch}) + }, &testOptions{nbParallelRequests: 1, nbWorkers: 1, workerScript: "worker-with-watcher.php", watch: watch}) } func fetchBody(method string, url string, handler func(http.ResponseWriter, *http.Request)) string { diff --git a/worker_test.go b/worker_test.go index b6df580f7..b12675c4e 100644 --- a/worker_test.go +++ b/worker_test.go @@ -43,7 +43,7 @@ func TestWorker(t *testing.T) { body2, _ := io.ReadAll(resp2.Body) assert.Contains(t, string(body2), fmt.Sprintf("Requests handled: %d", i*2+1)) - }, &testOptions{workerScript: "worker.php", nbWorkers: 1, nbParrallelRequests: 1}) + }, &testOptions{workerScript: "worker.php", nbWorkers: 1, nbParallelRequests: 1}) } func TestWorkerDie(t *testing.T) { @@ -51,7 +51,7 @@ func TestWorkerDie(t *testing.T) { req := httptest.NewRequest("GET", "http://example.com/die.php", nil) w := httptest.NewRecorder() handler(w, req) - }, &testOptions{workerScript: "die.php", nbWorkers: 1, nbParrallelRequests: 10}) + }, &testOptions{workerScript: "die.php", nbWorkers: 1, nbParallelRequests: 10}) } func TestNonWorkerModeAlwaysWorks(t *testing.T) { @@ -90,7 +90,7 @@ func TestWorkerEnv(t *testing.T) { body, _ := io.ReadAll(resp.Body) assert.Equal(t, fmt.Sprintf("bar%d", i), string(body)) - }, &testOptions{workerScript: "worker-env.php", nbWorkers: 1, env: map[string]string{"FOO": "bar"}, nbParrallelRequests: 10}) + }, &testOptions{workerScript: "worker-env.php", nbWorkers: 1, env: map[string]string{"FOO": "bar"}, nbParallelRequests: 10}) } func TestWorkerGetOpt(t *testing.T) { @@ -150,5 +150,5 @@ func TestWorkerHasOSEnvironmentVariableInSERVER(t *testing.T) { assert.Contains(t, string(body), "CUSTOM_OS_ENV_VARIABLE") assert.Contains(t, string(body), "custom_env_variable_value") - }, &testOptions{workerScript: "worker.php", nbWorkers: 1, nbParrallelRequests: 1}) + }, &testOptions{workerScript: "worker.php", nbWorkers: 1, nbParallelRequests: 1}) }