api-ecosystem-for-laravel / dingo-api

Replacement repo for dingo/api
BSD 3-Clause "New" or "Revised" License
265 stars 58 forks source link

Warning on requests with no Accept header set #37

Closed henrybark closed 8 months ago

henrybark commented 1 year ago
Q A
Bug? yes
New Feature? no
Framework Lumen
Framework version 10.0
Package version 4.1.0
PHP version 8.1.16

Actual Behaviour

If the application receives a request where the Accepts header is not set/null/'', the following warning is output

monolog.WARNING: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /app/vendor/api-ecosystem-for-laravel/dingo-api/src/Http/Parser/Accept.php on line 70 [] []

Expected Behaviour

A not set/null/'' Accepts header does not cause a warning

Steps to Reproduce

Clean application, a new route defined with dingo, make a request to that route with no Accepts header

Possible Solutions

On the line in question, default to '' or */* if the header is not set/null/''