diff options
author | Kate Butler <kate@innocraft.com> | 2019-08-06 22:44:54 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2019-08-06 22:44:54 +0300 |
commit | f1900e7bd08ceb3ada95fbacdd8dca167382f191 (patch) | |
tree | 8edddb81d10f00864a8d08762d33246b836c6401 /core/Http.php | |
parent | 05b003a5cd4612ff9fa9dcf6836d107b6154966d (diff) |
Avoid warning from passing 2 args to ucwords() on older PHP versions (#14734)
* Don't use ucwords on older versions of PHP
* Add comment
Diffstat (limited to 'core/Http.php')
-rw-r--r-- | core/Http.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/Http.php b/core/Http.php index ab75caa0da..b7b93e5e89 100644 --- a/core/Http.php +++ b/core/Http.php @@ -865,9 +865,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); + } } } |