Skip to content

Commit

Permalink
Merge branch 'QA_5_2'
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Feb 11, 2022
2 parents dd9d322 + d1b99c4 commit fb2a94c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions libraries/classes/ErrorHandler.php
Expand Up @@ -5,6 +5,7 @@
namespace PhpMyAdmin;

use ErrorException;
use Throwable;

use function __;
use function array_splice;
Expand All @@ -14,9 +15,9 @@
use function headers_sent;
use function htmlspecialchars;
use function set_error_handler;
use function set_exception_handler;
use function trigger_error;

use Throwable;
use const E_COMPILE_ERROR;
use const E_COMPILE_WARNING;
use const E_CORE_ERROR;
Expand Down Expand Up @@ -233,7 +234,7 @@ public function handleError(
*/
public function handleException(Throwable $exception): void
{
$config = $GLOBALS['PMA_Config'] ?? null;
$config = $GLOBALS['config'] ?? null;
$environment = $config instanceof Config ? $config->get('environment') : 'production';
if ($environment !== 'development') {
return;
Expand Down
11 changes: 6 additions & 5 deletions libraries/classes/Routing.php
Expand Up @@ -19,6 +19,7 @@
use function htmlspecialchars;
use function is_array;
use function is_readable;
use function is_string;
use function is_writable;
use function rawurldecode;
use function sprintf;
Expand Down Expand Up @@ -123,6 +124,7 @@ public static function writeCache(string $cacheContents): bool
*/
public static function getCurrentRoute(): string
{
/** @var mixed $route */
$route = $_GET['route'] ?? $_POST['route'] ?? '/';
if (! is_string($route) || $route === '') {
$route = '/';
Expand All @@ -133,11 +135,10 @@ public static function getCurrentRoute(): string
*
* @see https://docs.phpmyadmin.net/en/latest/faq.html#faq1-34
*/
if (($route === '/' || $route === '') && isset($_GET['db']) && $_GET['db'] !== '') {
$route = '/database/structure';
if (isset($_GET['table']) && $_GET['table'] !== '') {
$route = '/sql';
}
$db = isset($_GET['db']) && is_string($_GET['db']) ? $_GET['db'] : '';
if ($route === '/' && $db !== '') {
$table = isset($_GET['table']) && is_string($_GET['table']) ? $_GET['table'] : '';
$route = $table === '' ? '/database/structure' : '/sql';
}

return $route;
Expand Down

0 comments on commit fb2a94c

Please sign in to comment.