Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2020-03-05 03:36:12 +0300
committerGitHub <noreply@github.com>2020-03-05 03:36:12 +0300
commit0fd0b3039b23524e5959c2243a25fe2ff53db175 (patch)
treecd697c72bc52150a6d996d2c368dc330cc781f95 /core/Http.php
parent9c3c724aae2b87d15dab1fa130cee5a037bdfc1d (diff)
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 <kate@innocraft.com>
Diffstat (limited to 'core/Http.php')
-rw-r--r--core/Http.php9
1 files changed, 6 insertions, 3 deletions
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);
+ }
}
}