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

Avoid warning from passing 2 args to ucwords() on older PHP versions #14734

Merged
merged 2 commits into from Aug 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions core/Http.php
Expand Up @@ -865,9 +865,12 @@ private static function parseHeaderLine(&$headers, $line)
* With HTTP/2 Cloudflare is passing headers in lowercase (e.g. 'content-type' instead of 'Content-Type')
* which breaks any code which uses the header data.
*/
$camelName = ucwords($name, '-');
if ($camelName !== $name) {
$headers[$camelName] = trim($value);
if (version_compare(PHP_VERSION, '5.5.16', '>=')) {
// Passing a second arg to ucwords is not supported by older versions of PHP
$camelName = ucwords($name, '-');
if ($camelName !== $name) {
$headers[$camelName] = trim($value);
}
}
}

Expand Down