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

PHP Development Server considers a query with an emoji a 'Malformed HTTP request' #18129

Closed
JayGuerette opened this issue Mar 21, 2025 · 1 comment

Comments

@JayGuerette
Copy link

JayGuerette commented Mar 21, 2025

Description

The following code:

php -S 127.0.0.1:8080 &
curl 'http://127.0.0.1:8080/?🐦'

Resulted in this output:

[Fri Mar 21 18:07:22 2025] 127.0.0.1:49588 Invalid request (Malformed HTTP request)

But I expected this output instead:

[404]: GET /?🐦 - No such file or directory

A 404 is expected because there is no index.php, but it still indicates successful parsing of the request.

PHP Version

PHP 8.3.17

Operating System

Fedora 41

@TimWolla
Copy link
Member

The error is correct. curl sends the Emoji as-is on the wire:

GET /?🐦 HTTP/1.1
Host: 127.0.0.1:8080
User-Agent: curl/8.5.0
Accept: */*

This is the origin-form of RFC 9112, which is defined in terms of absolute-path from RFC 9110, which in turn is defined in terms of segment from RFC 3986, which requires percent-encoding for all non-ASCII characters.

@TimWolla TimWolla closed this as not planned Won't fix, can't repro, duplicate, stale Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants