Skip to content

Commit

Permalink
fix PHP 5.3 incompatability
Browse files Browse the repository at this point in the history
  • Loading branch information
aidantwoods committed Dec 23, 2016
1 parent c3325bb commit 14d30d8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion SecureHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,14 @@ public function add_header(
and preg_match('/([^:]+)/', $name, $match)
) {
$name = $match[1];
$capitalised_name = ucwords($name, "- \t\r\n\f\v");

$capitalised_name = preg_replace_callback(
'/(?<=[-\s]|^)[^-\s]/',
function ($match){
return strtoupper($match[0]);
},
$name
);
}
else
{
Expand Down

0 comments on commit 14d30d8

Please sign in to comment.