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

Numeric header names handling in PSR-7 message objects #159

Open
Xerkus opened this issue May 5, 2023 · 0 comments
Open

Numeric header names handling in PSR-7 message objects #159

Xerkus opened this issue May 5, 2023 · 0 comments
Assignees
Labels
Bug Something isn't working

Comments

@Xerkus
Copy link
Member

Xerkus commented May 5, 2023

PHP has little known quirk where array converts string keys consisting of integer value to integers . See PHP bug 80309 for more details.

Numeric header names failing type validation during ServerRequest instance creation from SAPI environment were reported in #11 and #157 handled it by filtering out numeric headers during server request creation from PHP globals.

However such headers could still be added to PSR-7 messages via withAddedHeader(string $name) and withHeader(string $name) methods, for example using string name like '1234'. Those headers will be an integer type when returned from getHeaders(), potentially causing ripple effect across user codebase expecting strongly typed string argument.

Since this behavior is universal across all implementations, @weierophinney will work with PHP-FIG to provide PSR-7 errata detailing expected handling of such headers. This is a tracking issue until such resolution is available.

@Xerkus Xerkus added the Bug Something isn't working label May 5, 2023
@weierophinney weierophinney self-assigned this May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants