Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "chore: bump deps and misc improvements" #1139

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ follow these steps:
1. Create a new directory named with the language's 2-character ISO code in this repository's `docs/` directory
2. Copy all the `.md` files in the root of the `docs/` directory into the new directory (always use the English version as source for translation, as it's always up to date)
3. Copy the `README.md` and `CONTRIBUTING.md` files from the root directory to the new directory
4. Translate the content of the files, but don't change the filenames, also don't translate strings starting with `> [!` (it's special markup for GitHub)
4. Translate the content of the files, but don't change the filenames, also don't translates strings starting with `> [!` (it's special markup for GitHub)
5. Create a Pull Request with the translations
6. In the [site repository](https://github.com/dunglas/frankenphp-website/tree/main), copy and translate the translation files in the `content/`, `data/` and `i18n/` directories
7. Translate the values in the created YAML file
Expand Down
2 changes: 1 addition & 1 deletion caddy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.60.1 // indirect
github.com/prometheus/common v0.60.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
github.com/quic-go/quic-go v0.48.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions caddy/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc=
github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw=
github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA=
github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
Expand Down
4 changes: 2 additions & 2 deletions caddy/php-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,12 @@ func cmdPHPServer(fs caddycmd.Flags) (int, error) {
Servers: map[string]*caddyhttp.Server{"php": server},
}

var f bool
var false bool
cfg := &caddy.Config{
Admin: &caddy.AdminConfig{
Disabled: true,
Config: &caddy.ConfigSettings{
Persist: &f,
Persist: &false,
},
},
AppsRaw: caddy.ModuleMap{
Expand Down
86 changes: 43 additions & 43 deletions cgi.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var knownServerKeys = map[string]struct{}{
//
// TODO: handle this case https://github.com/caddyserver/caddy/issues/3718
// Inspired by https://github.com/caddyserver/caddy/blob/master/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go
func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *FrankenPHPContext, trackVarsArray *C.zval) {
func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *FrankenPHPContext, track_vars_array *C.zval) {
keys := getKnownVariableKeys(thread)
// Separate remote IP and port; more lenient than net.SplitHostPort
var ip, port string
Expand All @@ -62,56 +62,56 @@ func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *Fra

ra, raOK := fc.env["REMOTE_ADDR\x00"]
if raOK {
registerTrustedVar(keys["REMOTE_ADDR\x00"], ra, trackVarsArray, thread)
registerTrustedVar(keys["REMOTE_ADDR\x00"], ra, track_vars_array, thread)
} else {
registerTrustedVar(keys["REMOTE_ADDR\x00"], ip, trackVarsArray, thread)
registerTrustedVar(keys["REMOTE_ADDR\x00"], ip, track_vars_array, thread)
}

if rh, ok := fc.env["REMOTE_HOST\x00"]; ok {
registerTrustedVar(keys["REMOTE_HOST\x00"], rh, trackVarsArray, thread) // For speed, remote host lookups disabled
registerTrustedVar(keys["REMOTE_HOST\x00"], rh, track_vars_array, thread) // For speed, remote host lookups disabled
} else {
if raOK {
registerTrustedVar(keys["REMOTE_HOST\x00"], ra, trackVarsArray, thread)
registerTrustedVar(keys["REMOTE_HOST\x00"], ra, track_vars_array, thread)
} else {
registerTrustedVar(keys["REMOTE_HOST\x00"], ip, trackVarsArray, thread)
registerTrustedVar(keys["REMOTE_HOST\x00"], ip, track_vars_array, thread)
}
}

registerTrustedVar(keys["REMOTE_PORT\x00"], port, trackVarsArray, thread)
registerTrustedVar(keys["DOCUMENT_ROOT\x00"], fc.documentRoot, trackVarsArray, thread)
registerTrustedVar(keys["PATH_INFO\x00"], fc.pathInfo, trackVarsArray, thread)
registerTrustedVar(keys["PHP_SELF\x00"], request.URL.Path, trackVarsArray, thread)
registerTrustedVar(keys["DOCUMENT_URI\x00"], fc.docURI, trackVarsArray, thread)
registerTrustedVar(keys["SCRIPT_FILENAME\x00"], fc.scriptFilename, trackVarsArray, thread)
registerTrustedVar(keys["SCRIPT_NAME\x00"], fc.scriptName, trackVarsArray, thread)
registerTrustedVar(keys["REMOTE_PORT\x00"], port, track_vars_array, thread)
registerTrustedVar(keys["DOCUMENT_ROOT\x00"], fc.documentRoot, track_vars_array, thread)
registerTrustedVar(keys["PATH_INFO\x00"], fc.pathInfo, track_vars_array, thread)
registerTrustedVar(keys["PHP_SELF\x00"], request.URL.Path, track_vars_array, thread)
registerTrustedVar(keys["DOCUMENT_URI\x00"], fc.docURI, track_vars_array, thread)
registerTrustedVar(keys["SCRIPT_FILENAME\x00"], fc.scriptFilename, track_vars_array, thread)
registerTrustedVar(keys["SCRIPT_NAME\x00"], fc.scriptName, track_vars_array, thread)

var rs string
if request.TLS == nil {
rs = "http"
registerTrustedVar(keys["HTTPS\x00"], "", trackVarsArray, thread)
registerTrustedVar(keys["SSL_PROTOCOL\x00"], "", trackVarsArray, thread)
registerTrustedVar(keys["HTTPS\x00"], "", track_vars_array, thread)
registerTrustedVar(keys["SSL_PROTOCOL\x00"], "", track_vars_array, thread)
} else {
rs = "https"
if h, ok := fc.env["HTTPS\x00"]; ok {
registerTrustedVar(keys["HTTPS\x00"], h, trackVarsArray, thread)
registerTrustedVar(keys["HTTPS\x00"], h, track_vars_array, thread)
} else {
registerTrustedVar(keys["HTTPS\x00"], "on", trackVarsArray, thread)
registerTrustedVar(keys["HTTPS\x00"], "on", track_vars_array, thread)
}

// and pass the protocol details in a manner compatible with apache's mod_ssl
// (which is why these have an SSL_ prefix and not TLS_).
// (which is why these have a SSL_ prefix and not TLS_).
if pr, ok := fc.env["SSL_PROTOCOL\x00"]; ok {
registerTrustedVar(keys["SSL_PROTOCOL\x00"], pr, trackVarsArray, thread)
registerTrustedVar(keys["SSL_PROTOCOL\x00"], pr, track_vars_array, thread)
} else {
if v, ok := tlsProtocolStrings[request.TLS.Version]; ok {
registerTrustedVar(keys["SSL_PROTOCOL\x00"], v, trackVarsArray, thread)
registerTrustedVar(keys["SSL_PROTOCOL\x00"], v, track_vars_array, thread)
} else {
registerTrustedVar(keys["SSL_PROTOCOL\x00"], "", trackVarsArray, thread)
registerTrustedVar(keys["SSL_PROTOCOL\x00"], "", track_vars_array, thread)
}
}
}

registerTrustedVar(keys["REQUEST_SCHEME\x00"], rs, trackVarsArray, thread)
registerTrustedVar(keys["REQUEST_SCHEME\x00"], rs, track_vars_array, thread)
reqHost, reqPort, _ := net.SplitHostPort(request.Host)

if reqHost == "" {
Expand All @@ -132,31 +132,31 @@ func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *Fra
}
}

registerTrustedVar(keys["SERVER_NAME\x00"], reqHost, trackVarsArray, thread)
registerTrustedVar(keys["SERVER_NAME\x00"], reqHost, track_vars_array, thread)
if reqPort != "" {
registerTrustedVar(keys["SERVER_PORT\x00"], reqPort, trackVarsArray, thread)
registerTrustedVar(keys["SERVER_PORT\x00"], reqPort, track_vars_array, thread)
} else {
registerTrustedVar(keys["SERVER_PORT\x00"], "", trackVarsArray, thread)
registerTrustedVar(keys["SERVER_PORT\x00"], "", track_vars_array, thread)
}

// Variables defined in CGI 1.1 spec
// Some variables are unused but cleared explicitly to prevent
// the parent environment from interfering.

// These values can not be overridden
registerTrustedVar(keys["CONTENT_LENGTH\x00"], request.Header.Get("Content-Length"), trackVarsArray, thread)
registerTrustedVar(keys["GATEWAY_INTERFACE\x00"], "CGI/1.1", trackVarsArray, thread)
registerTrustedVar(keys["SERVER_PROTOCOL\x00"], request.Proto, trackVarsArray, thread)
registerTrustedVar(keys["SERVER_SOFTWARE\x00"], "FrankenPHP", trackVarsArray, thread)
registerTrustedVar(keys["HTTP_HOST\x00"], request.Host, trackVarsArray, thread) // added here, since not always part of headers
registerTrustedVar(keys["CONTENT_LENGTH\x00"], request.Header.Get("Content-Length"), track_vars_array, thread)
registerTrustedVar(keys["GATEWAY_INTERFACE\x00"], "CGI/1.1", track_vars_array, thread)
registerTrustedVar(keys["SERVER_PROTOCOL\x00"], request.Proto, track_vars_array, thread)
registerTrustedVar(keys["SERVER_SOFTWARE\x00"], "FrankenPHP", track_vars_array, thread)
registerTrustedVar(keys["HTTP_HOST\x00"], request.Host, track_vars_array, thread) // added here, since not always part of headers

// These values are always empty but must be defined:
registerTrustedVar(keys["AUTH_TYPE\x00"], "", trackVarsArray, thread)
registerTrustedVar(keys["REMOTE_IDENT\x00"], "", trackVarsArray, thread)
registerTrustedVar(keys["AUTH_TYPE\x00"], "", track_vars_array, thread)
registerTrustedVar(keys["REMOTE_IDENT\x00"], "", track_vars_array, thread)

// These values are already present in the SG(request_info), so we'll register them from there
C.frankenphp_register_variables_from_request_info(
trackVarsArray,
track_vars_array,
keys["CONTENT_TYPE\x00"],
keys["PATH_TRANSLATED\x00"],
keys["QUERY_STRING\x00"],
Expand All @@ -166,11 +166,11 @@ func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *Fra
)
}

func registerTrustedVar(key *C.zend_string, value string, trackVarsArray *C.zval, thread *phpThread) {
C.frankenphp_register_trusted_var(key, thread.pinString(value), C.int(len(value)), trackVarsArray)
func registerTrustedVar(key *C.zend_string, value string, track_vars_array *C.zval, thread *phpThread) {
C.frankenphp_register_trusted_var(key, thread.pinString(value), C.int(len(value)), track_vars_array)
}

func addHeadersToServer(thread *phpThread, request *http.Request, fc *FrankenPHPContext, trackVarsArray *C.zval) {
func addHeadersToServer(thread *phpThread, request *http.Request, fc *FrankenPHPContext, track_vars_array *C.zval) {
for field, val := range request.Header {
k, ok := headerKeyCache.Get(field)
if !ok {
Expand All @@ -183,13 +183,13 @@ func addHeadersToServer(thread *phpThread, request *http.Request, fc *FrankenPHP
}

v := strings.Join(val, ", ")
C.frankenphp_register_variable_safe(thread.pinString(k), thread.pinString(v), C.size_t(len(v)), trackVarsArray)
C.frankenphp_register_variable_safe(thread.pinString(k), thread.pinString(v), C.size_t(len(v)), track_vars_array)
}
}

func addPreparedEnvToServer(thread *phpThread, fc *FrankenPHPContext, trackVarsArray *C.zval) {
func addPreparedEnvToServer(thread *phpThread, fc *FrankenPHPContext, track_vars_array *C.zval) {
for k, v := range fc.env {
C.frankenphp_register_variable_safe(thread.pinString(k), thread.pinString(v), C.size_t(len(v)), trackVarsArray)
C.frankenphp_register_variable_safe(thread.pinString(k), thread.pinString(v), C.size_t(len(v)), track_vars_array)
}
fc.env = nil
}
Expand All @@ -199,7 +199,7 @@ func getKnownVariableKeys(thread *phpThread) map[string]*C.zend_string {
return thread.knownVariableKeys
}
threadServerKeys := make(map[string]*C.zend_string)
for k := range knownServerKeys {
for k, _ := range knownServerKeys {
keyWithoutNull := strings.Replace(k, "\x00", "", -1)
threadServerKeys[k] = C.frankenphp_init_persistent_string(thread.pinString(keyWithoutNull), C.size_t(len(keyWithoutNull)))
}
Expand All @@ -219,8 +219,8 @@ func go_register_variables(threadIndex C.uintptr_t, trackVarsArray *C.zval) {
}

//export go_frankenphp_release_known_variable_keys
func go_frankenphp_release_known_variable_keys(threadIndex C.uintptr_t) {
thread := phpThreads[threadIndex]
func go_frankenphp_release_known_variable_keys(thread_index C.uintptr_t) {
thread := phpThreads[thread_index]
if thread.knownVariableKeys == nil {
return
}
Expand Down Expand Up @@ -280,7 +280,7 @@ func sanitizedPathJoin(root, reqPath string) string {
path := filepath.Join(root, filepath.Clean("/"+reqPath))

// filepath.Join also cleans the path, and cleaning strips
// the trailing slash, so we need to re-add it afterward.
// the trailing slash, so we need to re-add it afterwards.
// if the length is 1, then it's a path to the root,
// and that should return ".", so we don't append the separator.
if strings.HasSuffix(reqPath, "/") && len(reqPath) > 1 {
Expand Down
2 changes: 1 addition & 1 deletion docs/cn/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FrankenPHP: 适用于 PHP 的现代应用服务器

<h1 align="center"><a href="https://frankenphp.dev"><img src="../../frankenphp.png" alt="FrankenPHP" width="600"></a></h1>
<h1 align="center"><a href="https://frankenphp.dev"><img src="frankenphp.png" alt="FrankenPHP" width="600"></a></h1>

FrankenPHP 是建立在 [Caddy](https://caddyserver.com/) Web 服务器之上的现代 PHP 应用程序服务器。

Expand Down
4 changes: 2 additions & 2 deletions docs/cn/known-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ $fiber->resume();

已知以下扩展与 FrankenPHP 不兼容:

| 名称 | 原因 | 替代方案 |
|-------------------------------------------------------------|-------|----------------------------------------------------------------------------------------------------------------------|
| 名称 | 原因 | 替代方案 |
| ----------------------------------------------------------- | --------------- |----------------------------------------------------------------------------------------------------------------------|
| [imap](https://www.php.net/manual/en/imap.installation.php) | 非线程安全 | [javanile/php-imap2](https://github.com/javanile/php-imap2), [webklex/php-imap](https://github.com/Webklex/php-imap) |

## get_browser
Expand Down
2 changes: 1 addition & 1 deletion docs/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cd php-*/
```

Then, run the `configure` script with the options needed for your platform.
The following `./configure` flags are mandatory, but you can add others, for example to compile extensions or additional features.
Th following `./configure` flags are mandatory, but you can add others, for example to compile extensions or additional features.

### Linux

Expand Down
2 changes: 1 addition & 1 deletion docs/fr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Rendez-vous sur `https://localhost`, c'est parti !
> [!TIP]
>
> Ne tentez pas d'utiliser `https://127.0.0.1`. Utilisez `https://localhost` et acceptez le certificat auto-signé.
> Utilisez [la variable d'environnement `SERVER_NAME`](config.md#variables-denvironnement) pour changer le domaine à utiliser.
> Utilisez [la variable d'environnement `SERVER_NAME`](config.md#environment-variables) pour changer le domaine à utiliser.

### Binaire autonome

Expand Down
2 changes: 1 addition & 1 deletion docs/fr/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ L'image builder fournie par FrankenPHP contient une version compilée de `libphp
> [!TIP]
>
> Si vous utilisez Alpine Linux et Symfony,
> vous devrez peut-être [augmenter la taille de pile par défaut](compile.md#utiliser-xcaddy).
> vous devrez peut-être [augmenter la taille de pile par défaut](compile.md#using-xcaddy).

## Activer le mode Worker par défaut

Expand Down
9 changes: 5 additions & 4 deletions docs/fr/known-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ $fiber->resume();

Les extensions suivantes sont connues pour ne pas être compatibles avec FrankenPHP :

| Nom | Raison | Alternatives |
|-------------------------------------------------------------------------------------------------------------|-----------------|----------------------------------------------------------------------------------------------------------------------|
| [imap](https://www.php.net/manual/en/imap.installation.php) | Non thread-safe | [javanile/php-imap2](https://github.com/javanile/php-imap2), [webklex/php-imap](https://github.com/Webklex/php-imap) |
| [newrelic](https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/introduction-new-relic-php/) | Non thread-safe | - |
| Nom | Raison | Alternatives |
| ---------------------------------------------------------------------------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------- |
| [imap](https://www.php.net/manual/en/imap.installation.php) | Non thread-safe | [javanile/php-imap2](https://github.com/javanile/php-imap2), [webklex/php-imap](https://github.com/Webklex/php-imap) |
| [newrelic](https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/introduction-new-relic-php/)| Non thread-safe | - |

## Extensions PHP boguées

Expand All @@ -46,6 +46,7 @@ Les extensions suivantes ont des bugs connus ou des comportements inattendus lor
| Nom | Problème |
|---------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ext-openssl](https://www.php.net/manual/fr/book.openssl.php) | Lors de l'utilisation d'une version statique de FrankenPHP (construite avec la libc musl), l'extension OpenSSL peut planter sous de fortes charges. Une solution consiste à utiliser une version liée dynamiquement (comme celle utilisée dans les images Docker). Ce bogue est [suivi par PHP](https://github.com/php/php-src/issues/13648). |
| [parallel](https://github.com/krakjoe/parallel) | `parallel` fait geler et planter FrankenPHP. [Rapport de bogue](https://github.com/krakjoe/parallel/issues/308) |

## get_browser

Expand Down
Loading
Loading