From 0fd0b3039b23524e5959c2243a25fe2ff53db175 Mon Sep 17 00:00:00 2001 From: diosmosis Date: Wed, 4 Mar 2020 16:36:12 -0800 Subject: Avoid warning from passing 2 args to ucwords() on older PHP versions (#14734) (#15650) * Don't use ucwords on older versions of PHP * Add comment Co-authored-by: Kate Butler --- core/Http.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/Http.php') diff --git a/core/Http.php b/core/Http.php index f7dc89f9de..063379a727 100644 --- a/core/Http.php +++ b/core/Http.php @@ -934,9 +934,12 @@ class Http * 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); + } } } -- cgit v1.2.3