Skip to content

Commit 7a66d68

Browse files
committed
Avoid spilling local vars to global scope
1 parent ca283e8 commit 7a66d68

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

include/prepend.inc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ header("Content-language: en");
1212
header("Content-type: text/html; charset=utf-8");
1313

1414
/* Fix Silly Same Origin Policies */
15-
if (isset($_SERVER["HTTP_ORIGIN"])) {
15+
(function() {
16+
if (!isset($_SERVER["HTTP_ORIGIN"])) {
17+
return;
18+
}
19+
1620
$host = parse_url($_SERVER["HTTP_ORIGIN"]);
1721
if (strncmp(strrev($host["host"]), strrev("php.net"), strlen("php.net")) != 0) {
1822
if ($host["host"] != $_SERVER["SERVER_NAME"]) {
@@ -32,6 +36,8 @@ if (isset($_SERVER["HTTP_ORIGIN"])) {
3236
header("Access-Control-Allow-Headers: $headers");
3337
}
3438
}
39+
})();
40+
3541
/* Clickjacking workaround. Nothing should be in a frame so it could technically be 'deny'
3642
* but it doesn't make any difference anyway */
3743
header("X-Frame-Options: SAMEORIGIN");

0 commit comments

Comments
 (0)