Skip to content

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

Open
@Xerkus

Description

@Xerkus

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.

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions