summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
Diffstat (limited to 'it.class')
-rw-r--r--it.class21
1 files changed, 19 insertions, 2 deletions
diff --git a/it.class b/it.class
index 148b08f..2079e84 100644
--- a/it.class
+++ b/it.class
@@ -1335,7 +1335,7 @@ static function params2utf8()
foreach (['PHP_SELF', 'SCRIPT_NAME', 'SCRIPT_URL', 'SCRIPT_URI', 'HTTP_USER_AGENT'] as $var)
$_SERVER[$var] = it::any2utf8($_SERVER[$var]);
- $urlfix = function($m) { return urlencode(it::any2utf8(urldecode($m[0]))); };
+ $urlfix = function($m) { return urlencode(it::any2utf8(urldecode($m[0]))); }; # NOPHPLINT
foreach (['QUERY_STRING', 'REQUEST_URI', 'HTTP_REFERER'] as $var)
{
$_SERVER[$var.'_RAW'] = $_SERVER[$var];
@@ -1343,7 +1343,7 @@ static function params2utf8()
if (strpos($_SERVER[$var], '%') !== false)
{
- if (grapheme_strlen(urldecode($_SERVER[$var])) === null) # handle latin (double encodes correct utf8)
+ if (grapheme_strlen(urldecode($_SERVER[$var])) === null) # NOPHPLINT handle latin (double encodes correct utf8)
$_SERVER[$var] = preg_replace_callback('/%[89A-F][A-Z0-9]/i', $urlfix, $_SERVER[$var]);
while (preg_match('/%C3%8[23]%C2%[89ab][0-9a-f]/i', $_SERVER[$var]) && $iterations++ < 3) # handle doubly encoded utf8, UTF8SAFE
$_SERVER[$var] = preg_replace_callback('/%C3%8[23]%C2%[89ab][0-9a-f]/i', $urlfix, $_SERVER[$var]);
@@ -1366,4 +1366,21 @@ static function setcookie($name, $value, $p = [])
: @setcookie($name, $value, $p);
}
+static function urldecode($str)
+{
+ return it::any2utf8(urldecode($str)); # NOPHPLINT
+}
+
+static function parse_str($str) # note different usage
+{
+ parse_str($str, $request); # NOPHPLINT
+
+ return it::any2utf8($request);
+}
+
+static function request_body()
+{
+ return it::any2utf8(it::file_get_contents('php://input'));
+}
+
}