From cb8fd086de23e016a465870be8c2175c3f703334 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 19 Feb 2019 14:11:25 +0100 Subject: packages/differences.php: change uri-parsing to be hopefully more robust --- packages/differences.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/differences.php b/packages/differences.php index f12e0a2..f9b43af 100644 --- a/packages/differences.php +++ b/packages/differences.php @@ -5,18 +5,18 @@ require_once "../init.php"; require_once BASE . "/lib/style.php"; require_once BASE . "/lib/mysql.php"; -$uri_parts = explode('/', $_SERVER['REQUEST_URI']); +$uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2); +if (count($uri_parts) > 1) + $options = $uri_parts[1]; +else + $options = ''; + +$uri_parts = explode('/', $uri_parts[0]); if ($uri_parts[0] != '' || $uri_parts[1] != 'packages' || $uri_parts[2] != 'differences') throw_http_error(422, 'Unprocessable Entity'); -$options = ''; - $last = array_pop($uri_parts); -if (substr($last, 0, 1) == '?') { - $options = $last; - $last = array_pop($uri_parts); -} if ($last != '') array_push($uri_parts, $last); -- cgit v1.2.3-70-g09d2