Skip to content

Fallback to empty string if HTTP user agent does not exist in the context of the API call#46

Open
barion-vinczei wants to merge 1 commit intobarion:masterfrom
barion-vinczei:master
Open

Fallback to empty string if HTTP user agent does not exist in the context of the API call#46
barion-vinczei wants to merge 1 commit intobarion:masterfrom
barion-vinczei:master

Conversation

@barion-vinczei
Copy link
Copy Markdown
Collaborator

@barion-vinczei barion-vinczei commented Jan 29, 2026

$_SERVER['HTTP_USER_AGENT'] does not always exist (e.g if API is called from a command line / curl script). Some PHP8+ versions will throw an exception when accessing an array with a non-existing key. The array key should be explicitly checked and null values should fall back to an empty string.

…text of the API call

$_SERVER['HTTP_USER_AGENT'] does not always exist (e.g if API is called from a command line / curl script). Some PHP8+ versions will throw an exception when accessing an array with a non-existing key. The array key should be explicitly checked and null values should fall back to an empty string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant