Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Server/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public function GetLanguage()
*/
public function GetHeader($headerCode)
{
return $_SERVER[$headerCode];
return $_SERVER[$headerCode] ?? '';
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change returns an empty string for missing headers, which is inconsistent with other similar methods in the Server class. Methods like GetCookie, GetQuerystring, GetRawForm, and GetSession all return null for missing values.

Additionally, this is inconsistent with the IRestServer interface (lib/WebService/IRestServer.php:43), which defines GetHeader as returning string|null. While Server.php doesn't implement IRestServer, the inconsistency could cause confusion.

Consider using return $_SERVER[$headerCode] ?? null; instead to maintain consistency with the codebase pattern and match the interface definition.

Note: The docblock on line 268 also claims "@return string" but should be "@return string|null" to reflect the actual behavior.

Copilot uses AI. Check for mistakes.
}

/**
Expand Down