From 643e7b278a50b7afd5ce001128776dbbe780dd83 Mon Sep 17 00:00:00 2001 From: pupi1985 Date: Sun, 3 Mar 2024 16:23:57 -0300 Subject: [PATCH 1/2] Fix interpretation of plus signs --- qa-include/qa-index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qa-include/qa-index.php b/qa-include/qa-index.php index 6dc4f6625..ea207cc28 100644 --- a/qa-include/qa-index.php +++ b/qa-include/qa-index.php @@ -75,8 +75,8 @@ function qa_index_set_request() foreach ($params as $param) { if (preg_match('/^([^\=]*)(\=(.*))?$/', $param, $matches) && isset($matches[3])) { - $argument = strtr(rawurldecode($matches[1]), '.', '_'); // simulate PHP's $_GET behavior - $_GET[$argument] = qa_string_to_gpc(rawurldecode($matches[3])); + $argument = strtr(urldecode($matches[1]), '.', '_'); // simulate PHP's $_GET behavior + $_GET[$argument] = qa_string_to_gpc(urldecode($matches[3])); } } @@ -86,10 +86,10 @@ function qa_index_set_request() // Generally we assume that $_GET['qa-rewrite'] has the right path depth, but this won't be the case if there's // a & or # somewhere in the middle of the path, due to Apache unescaping. So we make a special case for that. // If 'REQUEST_URI' and 'qa-rewrite' already match (as on Nginx), we can skip this. - $normalizedpath = rawurldecode($origpath); + $normalizedpath = urldecode($origpath); if (substr($normalizedpath, -strlen($qa_rewrite)) !== $qa_rewrite) { $keepparts = count($requestparts); - $requestparts = explode('/', rawurldecode($origpath)); // new request calculated from $_SERVER['REQUEST_URI'] + $requestparts = explode('/', urldecode($origpath)); // new request calculated from $_SERVER['REQUEST_URI'] // loop forwards so we capture all parts for ($part = 0, $max = count($requestparts); $part < $max; $part++) { @@ -134,7 +134,7 @@ function qa_index_set_request() $origpath = substr($origpath, 0, $questionpos); } - $normalizedpath = rawurldecode($origpath); + $normalizedpath = urldecode($origpath); $indexpos = strpos($normalizedpath, $indexpath); } From f860c801be6c914143d2ffb0af4a845c31e0890a Mon Sep 17 00:00:00 2001 From: pupi1985 Date: Mon, 19 Aug 2024 22:44:20 -0300 Subject: [PATCH 2/2] Correct .htaccess file --- .htaccess-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.htaccess-example b/.htaccess-example index d3efe05fe..0ba0a5d6b 100644 --- a/.htaccess-example +++ b/.htaccess-example @@ -12,5 +12,5 @@ DirectoryIndex index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L] + RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [B,L]