diff --git a/composer.json b/composer.json index 781a18cda7..7ff7cc4c46 100644 --- a/composer.json +++ b/composer.json @@ -76,6 +76,7 @@ "symfony/polyfill-ctype": "^1.24", "symfony/polyfill-iconv": "^1.33", "symfony/polyfill-mbstring": "^1.24", + "symfony/polyfill-php84": "^1.33", "twig/twig": "^3.21", "webmozart/assert": "^1.10", "williamdes/mariadb-mysql-kbs": "^1.2" diff --git a/composer.lock b/composer.lock index 46f59cef90..fc5b4b038c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ca4cf75db346000f4f75159fcd66ec62", + "content-hash": "fa3a0d01a4eb2d8c3590344eaa02ca12", "packages": [ { "name": "composer/ca-bundle", @@ -1922,6 +1922,86 @@ ], "time": "2025-01-02T08:10:11+00:00" }, + { + "name": "symfony/polyfill-php84", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "d8ced4d875142b6a7426000426b8abc631d6b191" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/d8ced4d875142b6a7426000426b8abc631d6b191", + "reference": "d8ced4d875142b6a7426000426b8abc631d6b191", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php84/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-06-24T13:30:11+00:00" + }, { "name": "symfony/service-contracts", "version": "v3.6.0", @@ -9133,86 +9213,6 @@ ], "time": "2024-09-09T11:45:10+00:00" }, - { - "name": "symfony/polyfill-php84", - "version": "v1.33.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php84.git", - "reference": "d8ced4d875142b6a7426000426b8abc631d6b191" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/d8ced4d875142b6a7426000426b8abc631d6b191", - "reference": "d8ced4d875142b6a7426000426b8abc631d6b191", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php84\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php84/tree/v1.33.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2025-06-24T13:30:11+00:00" - }, { "name": "symfony/polyfill-uuid", "version": "v1.33.0", diff --git a/resources/templates/login/twofactor/application.twig b/resources/templates/login/twofactor/application.twig index ac5ff51cb1..d4622a0339 100644 --- a/resources/templates/login/twofactor/application.twig +++ b/resources/templates/login/twofactor/application.twig @@ -2,4 +2,4 @@ -{{ t('Open the two-factor authentication app on your device to view your authentication code and verify your identity.') }} +
{{ t('Open the two-factor authentication app on your device to view your authentication code and verify your identity.') }}
diff --git a/src/Sql.php b/src/Sql.php index d2a803a0a9..c42b22e9ab 100644 --- a/src/Sql.php +++ b/src/Sql.php @@ -30,10 +30,12 @@ use PhpMyAdmin\Utils\ForeignKey; use function __; use function array_column; +use function array_find_key; use function array_key_exists; use function array_keys; use function array_sum; use function arsort; +use function assert; use function bin2hex; use function ceil; use function count; @@ -46,6 +48,7 @@ use function session_write_close; use function sprintf; use function str_contains; use function str_replace; +use function strtoupper; use function ucwords; /** @@ -671,13 +674,33 @@ class Sql /** @var SelectStatement $statement */ $statement = $statementInfo->statement; + assert($statement->options !== null); + /** @var int|null $noCacheIndex */ + $noCacheIndex = array_find_key( + $statement->options->options, + static function (mixed $value): bool { + return is_string($value) && strtoupper($value) === 'SQL_NO_CACHE'; + }, + ); + $changeExpression = ! $statementInfo->flags->isGroup && ! $statementInfo->flags->distinct && ! $statementInfo->flags->union && count($statement->expr) === 1; - if ($statementInfo->flags->order || $statementInfo->flags->limit || $changeExpression) { + if ( + $statementInfo->flags->order + || $statementInfo->flags->limit + || $changeExpression + || $noCacheIndex !== null + ) { $statement = clone $statement; + // Remove SQL_NO_CACHE from subquery because it is not valid sql + if ($noCacheIndex !== null) { + assert($statement->options !== null); + $statement->options = clone $statement->options; + unset($statement->options->options[$noCacheIndex]); + } } // Remove ORDER BY to decrease unnecessary sorting time diff --git a/tests/unit/SqlTest.php b/tests/unit/SqlTest.php index c3a6b7d9c6..0c77eff2ba 100644 --- a/tests/unit/SqlTest.php +++ b/tests/unit/SqlTest.php @@ -410,6 +410,14 @@ class SqlTest extends AbstractTestCase false, 'SELECT COUNT(*) FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ) as cnt', ], + [ + 'SELECT SQL_NO_CACHE * FROM t1 WHERE id <> 0', + ['max_rows' => -1, 'pos' => 0], + 25, + 100, + false, + 'SELECT COUNT(*) FROM (SELECT 1 FROM t1 WHERE id <> 0 ) as cnt', + ], ]; }