diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2021-11-15 20:46:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-15 20:46:15 +0300 |
commit | f8988a124c3daf700baee88010e9b7dfc189a8b4 (patch) | |
tree | 8d02ae74ed52cb4a42470834a915b67920115acd | |
parent | 217764f87ec6bbd359c76e57f0f48897d7c47646 (diff) | |
parent | 2ae1a1d6f688ae8394d6559ee673fecbee975db4 (diff) |
Merge pull request #893 from nextcloud/bugfix/noid/patch-doctrine-dbal-with-4984
Bump doctrine/dbal to 3.1.4
40 files changed, 263 insertions, 140 deletions
diff --git a/composer.json b/composer.json index f553b88f..c15edd88 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "cweagans/composer-patches": "^1.7", "deepdiver/zipstreamer": "2.0.0", "deepdiver1975/tarstreamer": "v2.0.0", - "doctrine/dbal": "3.1.3", + "doctrine/dbal": "3.1.4", "egulias/email-validator": "3.1.1", "giggsey/libphonenumber-for-php": "^8.12", "guzzlehttp/guzzle": "^7.2", diff --git a/composer.lock b/composer.lock index 61867a16..48bf95bb 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": "7a2c615cf730c6a5dc98776c2ee9b53a", + "content-hash": "b24d5be8a91620fa2aa5be176e2435a1", "packages": [ { "name": "aws/aws-sdk-php", @@ -622,16 +622,16 @@ }, { "name": "doctrine/dbal", - "version": "3.1.3", + "version": "3.1.4", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "96b0053775a544b4a6ab47654dac0621be8b4cf8" + "reference": "821b4f01a36ce63ed36c090ea74767b72db367e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/96b0053775a544b4a6ab47654dac0621be8b4cf8", - "reference": "96b0053775a544b4a6ab47654dac0621be8b4cf8", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/821b4f01a36ce63ed36c090ea74767b72db367e9", + "reference": "821b4f01a36ce63ed36c090ea74767b72db367e9", "shasum": "" }, "require": { @@ -644,14 +644,14 @@ "require-dev": { "doctrine/coding-standard": "9.0.0", "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "0.12.99", - "phpstan/phpstan-strict-rules": "^0.12.11", + "phpstan/phpstan": "1.1.1", + "phpstan/phpstan-strict-rules": "^1", "phpunit/phpunit": "9.5.10", "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.0", + "squizlabs/php_codesniffer": "3.6.1", "symfony/cache": "^5.2|^6.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.10.0" + "vimeo/psalm": "4.12.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -711,7 +711,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.1.3" + "source": "https://github.com/doctrine/dbal/tree/3.1.4" }, "funding": [ { @@ -727,7 +727,7 @@ "type": "tidelift" } ], - "time": "2021-10-02T16:15:05+00:00" + "time": "2021-11-15T16:44:33+00:00" }, { "name": "doctrine/deprecations", diff --git a/composer/InstalledVersions.php b/composer/InstalledVersions.php index 7c5502ca..d50e0c9f 100644 --- a/composer/InstalledVersions.php +++ b/composer/InstalledVersions.php @@ -24,8 +24,21 @@ use Composer\Semver\VersionParser; */ class InstalledVersions { + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null + */ private static $installed; + + /** + * @var bool|null + */ private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> + */ private static $installedByVendor = array(); /** diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php index 8c32a709..636ba6b5 100644 --- a/composer/autoload_classmap.php +++ b/composer/autoload_classmap.php @@ -1098,6 +1098,8 @@ return array( 'Doctrine\\DBAL\\Query\\QueryException' => $vendorDir . '/doctrine/dbal/src/Query/QueryException.php', 'Doctrine\\DBAL\\Result' => $vendorDir . '/doctrine/dbal/src/Result.php', 'Doctrine\\DBAL\\SQL\\Parser' => $vendorDir . '/doctrine/dbal/src/SQL/Parser.php', + 'Doctrine\\DBAL\\SQL\\Parser\\Exception' => $vendorDir . '/doctrine/dbal/src/SQL/Parser/Exception.php', + 'Doctrine\\DBAL\\SQL\\Parser\\Exception\\RegularExpressionError' => $vendorDir . '/doctrine/dbal/src/SQL/Parser/Exception/RegularExpressionError.php', 'Doctrine\\DBAL\\SQL\\Parser\\Visitor' => $vendorDir . '/doctrine/dbal/src/SQL/Parser/Visitor.php', 'Doctrine\\DBAL\\Schema\\AbstractAsset' => $vendorDir . '/doctrine/dbal/src/Schema/AbstractAsset.php', 'Doctrine\\DBAL\\Schema\\AbstractSchemaManager' => $vendorDir . '/doctrine/dbal/src/Schema/AbstractSchemaManager.php', @@ -2064,15 +2066,6 @@ return array( 'Pimple\\Psr11\\ServiceLocator' => $vendorDir . '/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php', 'Pimple\\ServiceIterator' => $vendorDir . '/pimple/pimple/src/Pimple/ServiceIterator.php', 'Pimple\\ServiceProviderInterface' => $vendorDir . '/pimple/pimple/src/Pimple/ServiceProviderInterface.php', - 'Pimple\\Tests\\Fixtures\\Invokable' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php', - 'Pimple\\Tests\\Fixtures\\NonInvokable' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php', - 'Pimple\\Tests\\Fixtures\\PimpleServiceProvider' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php', - 'Pimple\\Tests\\Fixtures\\Service' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php', - 'Pimple\\Tests\\PimpleServiceProviderInterfaceTest' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php', - 'Pimple\\Tests\\PimpleTest' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/PimpleTest.php', - 'Pimple\\Tests\\Psr11\\ContainerTest' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php', - 'Pimple\\Tests\\Psr11\\ServiceLocatorTest' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php', - 'Pimple\\Tests\\ServiceIteratorTest' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php', 'Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php', 'Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php', 'Psr\\Container\\NotFoundExceptionInterface' => $vendorDir . '/psr/container/src/NotFoundExceptionInterface.php', @@ -2104,9 +2097,6 @@ return array( 'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerInterface.php', 'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php', 'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php', - 'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/DummyTest.php', - 'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', - 'Psr\\Log\\Test\\TestLogger' => $vendorDir . '/psr/log/Psr/Log/Test/TestLogger.php', 'Punic\\Calendar' => $vendorDir . '/punic/punic/code/Calendar.php', 'Punic\\Comparer' => $vendorDir . '/punic/punic/code/Comparer.php', 'Punic\\Currency' => $vendorDir . '/punic/punic/code/Currency.php', @@ -3010,9 +3000,7 @@ return array( 'Symfony\\Contracts\\Service\\ServiceProviderInterface' => $vendorDir . '/symfony/service-contracts/ServiceProviderInterface.php', 'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberInterface.php', 'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberTrait.php', - 'Symfony\\Contracts\\Service\\Test\\ServiceLocatorTest' => $vendorDir . '/symfony/service-contracts/Test/ServiceLocatorTest.php', 'Symfony\\Contracts\\Translation\\LocaleAwareInterface' => $vendorDir . '/symfony/translation-contracts/LocaleAwareInterface.php', - 'Symfony\\Contracts\\Translation\\Test\\TranslatorTest' => $vendorDir . '/symfony/translation-contracts/Test/TranslatorTest.php', 'Symfony\\Contracts\\Translation\\TranslatableInterface' => $vendorDir . '/symfony/translation-contracts/TranslatableInterface.php', 'Symfony\\Contracts\\Translation\\TranslatorInterface' => $vendorDir . '/symfony/translation-contracts/TranslatorInterface.php', 'Symfony\\Contracts\\Translation\\TranslatorTrait' => $vendorDir . '/symfony/translation-contracts/TranslatorTrait.php', diff --git a/composer/autoload_static.php b/composer/autoload_static.php index 0248df8f..8ab95233 100644 --- a/composer/autoload_static.php +++ b/composer/autoload_static.php @@ -1728,6 +1728,8 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Doctrine\\DBAL\\Query\\QueryException' => __DIR__ . '/..' . '/doctrine/dbal/src/Query/QueryException.php', 'Doctrine\\DBAL\\Result' => __DIR__ . '/..' . '/doctrine/dbal/src/Result.php', 'Doctrine\\DBAL\\SQL\\Parser' => __DIR__ . '/..' . '/doctrine/dbal/src/SQL/Parser.php', + 'Doctrine\\DBAL\\SQL\\Parser\\Exception' => __DIR__ . '/..' . '/doctrine/dbal/src/SQL/Parser/Exception.php', + 'Doctrine\\DBAL\\SQL\\Parser\\Exception\\RegularExpressionError' => __DIR__ . '/..' . '/doctrine/dbal/src/SQL/Parser/Exception/RegularExpressionError.php', 'Doctrine\\DBAL\\SQL\\Parser\\Visitor' => __DIR__ . '/..' . '/doctrine/dbal/src/SQL/Parser/Visitor.php', 'Doctrine\\DBAL\\Schema\\AbstractAsset' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/AbstractAsset.php', 'Doctrine\\DBAL\\Schema\\AbstractSchemaManager' => __DIR__ . '/..' . '/doctrine/dbal/src/Schema/AbstractSchemaManager.php', @@ -2694,15 +2696,6 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Pimple\\Psr11\\ServiceLocator' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php', 'Pimple\\ServiceIterator' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/ServiceIterator.php', 'Pimple\\ServiceProviderInterface' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/ServiceProviderInterface.php', - 'Pimple\\Tests\\Fixtures\\Invokable' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php', - 'Pimple\\Tests\\Fixtures\\NonInvokable' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php', - 'Pimple\\Tests\\Fixtures\\PimpleServiceProvider' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php', - 'Pimple\\Tests\\Fixtures\\Service' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php', - 'Pimple\\Tests\\PimpleServiceProviderInterfaceTest' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php', - 'Pimple\\Tests\\PimpleTest' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/PimpleTest.php', - 'Pimple\\Tests\\Psr11\\ContainerTest' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php', - 'Pimple\\Tests\\Psr11\\ServiceLocatorTest' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php', - 'Pimple\\Tests\\ServiceIteratorTest' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php', 'Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php', 'Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php', 'Psr\\Container\\NotFoundExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/NotFoundExceptionInterface.php', @@ -2734,9 +2727,6 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php', 'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php', 'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php', - 'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/DummyTest.php', - 'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', - 'Psr\\Log\\Test\\TestLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/TestLogger.php', 'Punic\\Calendar' => __DIR__ . '/..' . '/punic/punic/code/Calendar.php', 'Punic\\Comparer' => __DIR__ . '/..' . '/punic/punic/code/Comparer.php', 'Punic\\Currency' => __DIR__ . '/..' . '/punic/punic/code/Currency.php', @@ -3640,9 +3630,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Symfony\\Contracts\\Service\\ServiceProviderInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceProviderInterface.php', 'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberInterface.php', 'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberTrait.php', - 'Symfony\\Contracts\\Service\\Test\\ServiceLocatorTest' => __DIR__ . '/..' . '/symfony/service-contracts/Test/ServiceLocatorTest.php', 'Symfony\\Contracts\\Translation\\LocaleAwareInterface' => __DIR__ . '/..' . '/symfony/translation-contracts/LocaleAwareInterface.php', - 'Symfony\\Contracts\\Translation\\Test\\TranslatorTest' => __DIR__ . '/..' . '/symfony/translation-contracts/Test/TranslatorTest.php', 'Symfony\\Contracts\\Translation\\TranslatableInterface' => __DIR__ . '/..' . '/symfony/translation-contracts/TranslatableInterface.php', 'Symfony\\Contracts\\Translation\\TranslatorInterface' => __DIR__ . '/..' . '/symfony/translation-contracts/TranslatorInterface.php', 'Symfony\\Contracts\\Translation\\TranslatorTrait' => __DIR__ . '/..' . '/symfony/translation-contracts/TranslatorTrait.php', diff --git a/composer/installed.json b/composer/installed.json index 803f729f..fd5448c1 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -646,17 +646,17 @@ }, { "name": "doctrine/dbal", - "version": "3.1.3", - "version_normalized": "3.1.3.0", + "version": "3.1.4", + "version_normalized": "3.1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "96b0053775a544b4a6ab47654dac0621be8b4cf8" + "reference": "821b4f01a36ce63ed36c090ea74767b72db367e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/96b0053775a544b4a6ab47654dac0621be8b4cf8", - "reference": "96b0053775a544b4a6ab47654dac0621be8b4cf8", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/821b4f01a36ce63ed36c090ea74767b72db367e9", + "reference": "821b4f01a36ce63ed36c090ea74767b72db367e9", "shasum": "" }, "require": { @@ -669,19 +669,19 @@ "require-dev": { "doctrine/coding-standard": "9.0.0", "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "0.12.99", - "phpstan/phpstan-strict-rules": "^0.12.11", + "phpstan/phpstan": "1.1.1", + "phpstan/phpstan-strict-rules": "^1", "phpunit/phpunit": "9.5.10", "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.0", + "squizlabs/php_codesniffer": "3.6.1", "symfony/cache": "^5.2|^6.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.10.0" + "vimeo/psalm": "4.12.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." }, - "time": "2021-10-02T16:15:05+00:00", + "time": "2021-11-15T16:44:33+00:00", "bin": [ "bin/doctrine-dbal" ], @@ -738,7 +738,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.1.3" + "source": "https://github.com/doctrine/dbal/tree/3.1.4" }, "funding": [ { @@ -6206,6 +6206,6 @@ "install-path": "../web-auth/webauthn-lib" } ], - "dev": false, + "dev": true, "dev-package-names": [] } diff --git a/composer/installed.php b/composer/installed.php index 686943ff..bfd6851e 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -5,9 +5,9 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), - 'reference' => '1d7fff4111e438dd496fb8a5d518ea6b8b910b83', + 'reference' => '217764f87ec6bbd359c76e57f0f48897d7c47646', 'name' => 'nextcloud/3rdparty', - 'dev' => false, + 'dev' => true, ), 'versions' => array( 'aws/aws-sdk-php' => array( @@ -101,12 +101,12 @@ 'dev_requirement' => false, ), 'doctrine/dbal' => array( - 'pretty_version' => '3.1.3', - 'version' => '3.1.3.0', + 'pretty_version' => '3.1.4', + 'version' => '3.1.4.0', 'type' => 'library', 'install_path' => __DIR__ . '/../doctrine/dbal', 'aliases' => array(), - 'reference' => '96b0053775a544b4a6ab47654dac0621be8b4cf8', + 'reference' => '821b4f01a36ce63ed36c090ea74767b72db367e9', 'dev_requirement' => false, ), 'doctrine/deprecations' => array( @@ -286,7 +286,7 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), - 'reference' => '1d7fff4111e438dd496fb8a5d518ea6b8b910b83', + 'reference' => '217764f87ec6bbd359c76e57f0f48897d7c47646', 'dev_requirement' => false, ), 'nextcloud/lognormalizer' => array( diff --git a/composer/package-versions-deprecated/src/PackageVersions/Versions.php b/composer/package-versions-deprecated/src/PackageVersions/Versions.php index 9d9dd6a5..d277442d 100644 --- a/composer/package-versions-deprecated/src/PackageVersions/Versions.php +++ b/composer/package-versions-deprecated/src/PackageVersions/Versions.php @@ -43,7 +43,7 @@ final class Versions 'deepdiver/zipstreamer' => '2.0.0@b8c59647ff34fb97e8937aefb2a65de2bc4b4755', 'deepdiver1975/tarstreamer' => '2.0.0@ad48505d1ab54a8e94e6b1cc5297bbed72e956de', 'doctrine/cache' => '2.1.1@331b4d5dbaeab3827976273e9356b3b453c300ce', - 'doctrine/dbal' => '3.1.3@96b0053775a544b4a6ab47654dac0621be8b4cf8', + 'doctrine/dbal' => '3.1.4@821b4f01a36ce63ed36c090ea74767b72db367e9', 'doctrine/deprecations' => 'v0.5.3@9504165960a1f83cc1480e2be1dd0a0478561314', 'doctrine/event-manager' => '1.1.1@41370af6a30faa9dc0368c4a6814d596e81aba7f', 'doctrine/lexer' => '1.2.1@e864bbf5904cb8f5bb334f99209b48018522f042', @@ -119,7 +119,7 @@ final class Versions 'web-auth/cose-lib' => 'v3.3.9@ed172d2dc1a6b87b5c644c07c118cd30c1b3819b', 'web-auth/metadata-service' => 'v3.3.9@8488d3a832a38cc81c670fce05de1e515c6e64b1', 'web-auth/webauthn-lib' => 'v3.3.9@04b98ee3d39cb79dad68a7c15c297c085bf66bfe', - 'nextcloud/3rdparty' => 'dev-master@1d7fff4111e438dd496fb8a5d518ea6b8b910b83', + 'nextcloud/3rdparty' => 'dev-master@217764f87ec6bbd359c76e57f0f48897d7c47646', ); private function __construct() diff --git a/doctrine/dbal/README.md b/doctrine/dbal/README.md index 43caa5a5..8a175788 100644 --- a/doctrine/dbal/README.md +++ b/doctrine/dbal/README.md @@ -7,7 +7,7 @@ | [![Code Coverage][Coverage image]][CodeCov 4.0] | [![Code Coverage][Coverage 3.1 image]][CodeCov 3.1] | [![Code Coverage][Coverage 2.13 image]][CodeCov 2.13] | | N/A | [![Code Coverage][TypeCov 3.1 image]][TypeCov 3.1] | N/A | -Powerful database abstraction layer with many features for database schema introspection, schema management and PDO abstraction. +Powerful ***D***ata***B***ase ***A***bstraction ***L***ayer with many features for database schema introspection and schema management. ## More resources: diff --git a/doctrine/dbal/composer.json b/doctrine/dbal/composer.json index 013b6b8d..2374d79c 100644 --- a/doctrine/dbal/composer.json +++ b/doctrine/dbal/composer.json @@ -40,14 +40,14 @@ "require-dev": { "doctrine/coding-standard": "9.0.0", "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "0.12.99", - "phpstan/phpstan-strict-rules": "^0.12.11", + "phpstan/phpstan": "1.1.1", + "phpstan/phpstan-strict-rules": "^1", "phpunit/phpunit": "9.5.10", "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.0", + "squizlabs/php_codesniffer": "3.6.1", "symfony/cache": "^5.2|^6.0", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.10.0" + "vimeo/psalm": "4.12.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." diff --git a/doctrine/dbal/src/Cache/QueryCacheProfile.php b/doctrine/dbal/src/Cache/QueryCacheProfile.php index 44f5868c..21bd144d 100644 --- a/doctrine/dbal/src/Cache/QueryCacheProfile.php +++ b/doctrine/dbal/src/Cache/QueryCacheProfile.php @@ -78,6 +78,10 @@ class QueryCacheProfile */ public function generateCacheKeys($sql, $params, $types, array $connectionParams = []) { + if (isset($connectionParams['password'])) { + unset($connectionParams['password']); + } + $realCacheKey = 'query=' . $sql . '¶ms=' . serialize($params) . '&types=' . serialize($types) . diff --git a/doctrine/dbal/src/Connection.php b/doctrine/dbal/src/Connection.php index 46648423..7b3686c6 100644 --- a/doctrine/dbal/src/Connection.php +++ b/doctrine/dbal/src/Connection.php @@ -1198,7 +1198,7 @@ class Connection * * @param string|null $name Name of the sequence object from which the ID should be returned. * - * @return string A string representation of the last inserted ID. + * @return string|int|false A string representation of the last inserted ID. * * @throws Exception */ @@ -1674,11 +1674,11 @@ class Connection * @param mixed $value The value to bind. * @param int|string|Type|null $type The type to bind (PDO or DBAL). * - * @return mixed[] [0] => the (escaped) value, [1] => the binding type. + * @return array{mixed, int} [0] => the (escaped) value, [1] => the binding type. * * @throws Exception */ - private function getBindingInfo($value, $type) + private function getBindingInfo($value, $type): array { if (is_string($type)) { $type = Type::getType($type); @@ -1688,7 +1688,7 @@ class Connection $value = $type->convertToDatabaseValue($value, $this->getDatabasePlatform()); $bindingType = $type->getBindingType(); } else { - $bindingType = $type; + $bindingType = $type ?? ParameterType::STRING; } return [$value, $bindingType]; diff --git a/doctrine/dbal/src/Driver/Connection.php b/doctrine/dbal/src/Driver/Connection.php index 73a77730..9febe72a 100644 --- a/doctrine/dbal/src/Driver/Connection.php +++ b/doctrine/dbal/src/Driver/Connection.php @@ -46,7 +46,7 @@ interface Connection * * @param string|null $name * - * @return string + * @return string|int|false * * @throws Exception */ diff --git a/doctrine/dbal/src/Driver/Mysqli/Connection.php b/doctrine/dbal/src/Driver/Mysqli/Connection.php index bec38011..73634536 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Connection.php +++ b/doctrine/dbal/src/Driver/Mysqli/Connection.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\ParameterType; use mysqli; +use mysqli_sql_exception; use function assert; use function floor; @@ -41,7 +42,7 @@ final class Connection implements ServerInfoAwareConnection ?string $database = null, ?int $port = null, ?string $socket = null, - ?int $flags = null, + int $flags = 0, iterable $preInitializers = [], iterable $postInitializers = [] ) { @@ -52,7 +53,13 @@ final class Connection implements ServerInfoAwareConnection $initializer->initialize($connection); } - if (! @$connection->real_connect($host, $username, $password, $database, $port, $socket, $flags)) { + try { + $success = @$connection->real_connect($host, $username, $password, $database, $port, $socket, $flags); + } catch (mysqli_sql_exception $e) { + throw ConnectionFailed::upcast($e); + } + + if (! $success) { throw ConnectionFailed::new($connection); } @@ -117,7 +124,13 @@ final class Connection implements ServerInfoAwareConnection public function exec(string $sql): int { - if ($this->conn->query($sql) === false) { + try { + $result = $this->conn->query($sql); + } catch (mysqli_sql_exception $e) { + throw ConnectionError::upcast($e); + } + + if ($result === false) { throw ConnectionError::new($this->conn); } @@ -147,7 +160,11 @@ final class Connection implements ServerInfoAwareConnection */ public function commit() { - return $this->conn->commit(); + try { + return $this->conn->commit(); + } catch (mysqli_sql_exception $e) { + return false; + } } /** @@ -155,6 +172,10 @@ final class Connection implements ServerInfoAwareConnection */ public function rollBack() { - return $this->conn->rollback(); + try { + return $this->conn->rollback(); + } catch (mysqli_sql_exception $e) { + return false; + } } } diff --git a/doctrine/dbal/src/Driver/Mysqli/Driver.php b/doctrine/dbal/src/Driver/Mysqli/Driver.php index 28897ed3..d459863d 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Driver.php +++ b/doctrine/dbal/src/Driver/Mysqli/Driver.php @@ -29,7 +29,7 @@ final class Driver extends AbstractMySQLDriver $host = $params['host'] ?? null; } - $flags = null; + $flags = 0; $preInitializers = $postInitializers = []; diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php index 25c33f06..ef5b9801 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php @@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception; use Doctrine\DBAL\Driver\AbstractException; use mysqli; +use mysqli_sql_exception; +use ReflectionProperty; /** * @internal @@ -18,4 +20,12 @@ final class ConnectionError extends AbstractException { return new self($connection->error, $connection->sqlstate, $connection->errno); } + + public static function upcast(mysqli_sql_exception $exception): self + { + $p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate'); + $p->setAccessible(true); + + return new self($exception->getMessage(), $p->getValue($exception), (int) $exception->getCode(), $exception); + } } diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php index 16cab72e..faceeb08 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php @@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception; use Doctrine\DBAL\Driver\AbstractException; use mysqli; +use mysqli_sql_exception; +use ReflectionProperty; /** * @internal @@ -18,4 +20,12 @@ final class ConnectionFailed extends AbstractException { return new self($connection->connect_error, 'HY000', $connection->connect_errno); } + + public static function upcast(mysqli_sql_exception $exception): self + { + $p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate'); + $p->setAccessible(true); + + return new self($exception->getMessage(), $p->getValue($exception), (int) $exception->getCode(), $exception); + } } diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php b/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php index 7ac275d9..763b4eb7 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php @@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception; use Doctrine\DBAL\Driver\AbstractException; use mysqli; +use mysqli_sql_exception; +use ReflectionProperty; use function sprintf; @@ -24,4 +26,17 @@ final class InvalidCharset extends AbstractException $connection->errno ); } + + public static function upcast(mysqli_sql_exception $exception, string $charset): self + { + $p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate'); + $p->setAccessible(true); + + return new self( + sprintf('Failed to set charset "%s": %s', $charset, $exception->getMessage()), + $p->getValue($exception), + (int) $exception->getCode(), + $exception + ); + } } diff --git a/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php b/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php index 70b0db77..78dc8556 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php +++ b/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php @@ -5,7 +5,9 @@ declare(strict_types=1); namespace Doctrine\DBAL\Driver\Mysqli\Exception; use Doctrine\DBAL\Driver\AbstractException; +use mysqli_sql_exception; use mysqli_stmt; +use ReflectionProperty; /** * @internal @@ -18,4 +20,12 @@ final class StatementError extends AbstractException { return new self($statement->error, $statement->sqlstate, $statement->errno); } + + public static function upcast(mysqli_sql_exception $exception): self + { + $p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate'); + $p->setAccessible(true); + + return new self($exception->getMessage(), $p->getValue($exception), (int) $exception->getCode(), $exception); + } } diff --git a/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php b/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php index 362c95fe..b32ecaf9 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php +++ b/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php @@ -7,6 +7,7 @@ namespace Doctrine\DBAL\Driver\Mysqli\Initializer; use Doctrine\DBAL\Driver\Mysqli\Exception\InvalidCharset; use Doctrine\DBAL\Driver\Mysqli\Initializer; use mysqli; +use mysqli_sql_exception; final class Charset implements Initializer { @@ -20,7 +21,13 @@ final class Charset implements Initializer public function initialize(mysqli $connection): void { - if ($connection->set_charset($this->charset)) { + try { + $success = $connection->set_charset($this->charset); + } catch (mysqli_sql_exception $e) { + throw InvalidCharset::upcast($e, $this->charset); + } + + if ($success) { return; } diff --git a/doctrine/dbal/src/Driver/Mysqli/Result.php b/doctrine/dbal/src/Driver/Mysqli/Result.php index 11e00f0b..23047152 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Result.php +++ b/doctrine/dbal/src/Driver/Mysqli/Result.php @@ -8,15 +8,14 @@ use Doctrine\DBAL\Driver\Exception; use Doctrine\DBAL\Driver\FetchUtils; use Doctrine\DBAL\Driver\Mysqli\Exception\StatementError; use Doctrine\DBAL\Driver\Result as ResultInterface; +use mysqli_sql_exception; use mysqli_stmt; use stdClass; use function array_combine; use function array_fill; use function array_map; -use function assert; use function count; -use function is_array; final class Result implements ResultInterface { @@ -60,7 +59,6 @@ final class Result implements ResultInterface $this->hasColumns = true; $fields = $meta->fetch_fields(); - assert(is_array($fields)); $this->columnNames = array_map(static function (stdClass $field): string { return $field->name; @@ -101,7 +99,11 @@ final class Result implements ResultInterface */ public function fetchNumeric() { - $ret = $this->statement->fetch(); + try { + $ret = $this->statement->fetch(); + } catch (mysqli_sql_exception $e) { + throw StatementError::upcast($e); + } if ($ret === false) { throw StatementError::new($this->statement); diff --git a/doctrine/dbal/src/Driver/Mysqli/Statement.php b/doctrine/dbal/src/Driver/Mysqli/Statement.php index 9f802e11..249cb2c8 100644 --- a/doctrine/dbal/src/Driver/Mysqli/Statement.php +++ b/doctrine/dbal/src/Driver/Mysqli/Statement.php @@ -12,6 +12,7 @@ use Doctrine\DBAL\Driver\Result as ResultInterface; use Doctrine\DBAL\Driver\Statement as StatementInterface; use Doctrine\DBAL\ParameterType; use mysqli; +use mysqli_sql_exception; use mysqli_stmt; use function array_fill; @@ -43,7 +44,7 @@ final class Statement implements StatementInterface /** @var mysqli_stmt */ protected $_stmt; - /** @var mixed[]|null */ + /** @var mixed[] */ protected $_bindedValues; /** @var string */ @@ -67,7 +68,11 @@ final class Statement implements StatementInterface { $this->_conn = $conn; - $stmt = $conn->prepare($prepareString); + try { + $stmt = $conn->prepare($prepareString); + } catch (mysqli_sql_exception $e) { + throw ConnectionError::upcast($e); + } if ($stmt === false) { throw ConnectionError::new($this->_conn); @@ -75,11 +80,7 @@ final class Statement implements StatementInterface $this->_stmt = $stmt; - $paramCount = $this->_stmt->param_count; - if (0 >= $paramCount) { - return; - } - + $paramCount = $this->_stmt->param_count; $this->types = str_repeat('s', $paramCount); $this->_bindedValues = array_fill(1, $paramCount, null); } @@ -124,17 +125,21 @@ final class Statement implements StatementInterface */ public function execute($params = null): ResultInterface { - if ($this->_bindedValues !== null) { - if ($params !== null) { - if (! $this->bindUntypedValues($params)) { - throw StatementError::new($this->_stmt); - } - } else { - $this->bindTypedParameters(); + if ($params !== null && count($params) > 0) { + if (! $this->bindUntypedValues($params)) { + throw StatementError::new($this->_stmt); } + } elseif (count($this->_bindedValues) > 0) { + $this->bindTypedParameters(); + } + + try { + $result = $this->_stmt->execute(); + } catch (mysqli_sql_exception $e) { + throw StatementError::upcast($e); } - if (! $this->_stmt->execute()) { + if (! $result) { throw StatementError::new($this->_stmt); } diff --git a/doctrine/dbal/src/Driver/OCI8/Connection.php b/doctrine/dbal/src/Driver/OCI8/Connection.php index 1bc5c62c..b05892f9 100644 --- a/doctrine/dbal/src/Driver/OCI8/Connection.php +++ b/doctrine/dbal/src/Driver/OCI8/Connection.php @@ -78,7 +78,8 @@ final class Connection implements ServerInfoAwareConnection throw Error::new($this->dbh); } - assert(preg_match('/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/', $version, $matches) === 1); + $result = preg_match('/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/', $version, $matches); + assert($result === 1); return $matches[1]; } diff --git a/doctrine/dbal/src/Driver/OCI8/Statement.php b/doctrine/dbal/src/Driver/OCI8/Statement.php index 1f3afda2..56602a36 100644 --- a/doctrine/dbal/src/Driver/OCI8/Statement.php +++ b/doctrine/dbal/src/Driver/OCI8/Statement.php @@ -98,9 +98,6 @@ final class Statement implements StatementInterface if ($type === ParameterType::LARGE_OBJECT) { $lob = oci_new_descriptor($this->_dbh, OCI_D_LOB); - - assert($lob !== false); - $lob->writeTemporary($variable, OCI_TEMP_BLOB); $variable =& $lob; diff --git a/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php b/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php index d2da1625..2f48874e 100644 --- a/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php +++ b/doctrine/dbal/src/Driver/PDO/SQLSrv/Statement.php @@ -59,7 +59,7 @@ final class Statement implements StatementInterface break; } - return $this->statement->bindParam($param, $variable, $type, $length, $driverOptions); + return $this->statement->bindParam($param, $variable, $type, $length ?? 0, $driverOptions); } /** diff --git a/doctrine/dbal/src/DriverManager.php b/doctrine/dbal/src/DriverManager.php index 58a0cc57..698e0438 100644 --- a/doctrine/dbal/src/DriverManager.php +++ b/doctrine/dbal/src/DriverManager.php @@ -11,7 +11,6 @@ use Doctrine\DBAL\Driver\SQLSrv; use function array_keys; use function array_merge; -use function assert; use function class_implements; use function in_array; use function is_string; @@ -299,8 +298,6 @@ final class DriverManager // (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid $url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $params['url']); - assert(is_string($url)); - $url = parse_url($url); if ($url === false) { diff --git a/doctrine/dbal/src/Platforms/AbstractPlatform.php b/doctrine/dbal/src/Platforms/AbstractPlatform.php index e7f0819b..f22fab5b 100644 --- a/doctrine/dbal/src/Platforms/AbstractPlatform.php +++ b/doctrine/dbal/src/Platforms/AbstractPlatform.php @@ -3365,7 +3365,11 @@ abstract class AbstractPlatform )); } - return $this->doModifyLimitQuery($query, $limit, $offset); + if ($limit !== null) { + $limit = (int) $limit; + } + + return $this->doModifyLimitQuery($query, $limit, (int) $offset); } /** diff --git a/doctrine/dbal/src/Platforms/MariaDb1027Platform.php b/doctrine/dbal/src/Platforms/MariaDb1027Platform.php index 9fa84e98..bb8e0b88 100644 --- a/doctrine/dbal/src/Platforms/MariaDb1027Platform.php +++ b/doctrine/dbal/src/Platforms/MariaDb1027Platform.php @@ -10,7 +10,7 @@ use Doctrine\Deprecations\Deprecation; * * Note: Should not be used with versions prior to 10.2.7. */ -final class MariaDb1027Platform extends MySQLPlatform +class MariaDb1027Platform extends MySQLPlatform { /** * {@inheritdoc} diff --git a/doctrine/dbal/src/Platforms/MySQLPlatform.php b/doctrine/dbal/src/Platforms/MySQLPlatform.php index 06bc5975..379616f2 100644 --- a/doctrine/dbal/src/Platforms/MySQLPlatform.php +++ b/doctrine/dbal/src/Platforms/MySQLPlatform.php @@ -185,7 +185,7 @@ class MySQLPlatform extends AbstractPlatform } $sql = 'SELECT DISTINCT k.`CONSTRAINT_NAME`, k.`COLUMN_NAME`, k.`REFERENCED_TABLE_NAME`, ' . - 'k.`REFERENCED_COLUMN_NAME` /*!50116 , c.update_rule, c.delete_rule */ ' . + 'k.`REFERENCED_COLUMN_NAME`, k.`ORDINAL_POSITION` /*!50116 , c.update_rule, c.delete_rule */ ' . 'FROM information_schema.key_column_usage k /*!50116 ' . 'INNER JOIN information_schema.referential_constraints c ON ' . ' c.constraint_name = k.constraint_name AND ' . @@ -195,7 +195,8 @@ class MySQLPlatform extends AbstractPlatform return $sql . ' AND k.table_schema = ' . $databaseNameSql . ' /*!50116 AND c.constraint_schema = ' . $databaseNameSql . ' */' - . ' AND k.`REFERENCED_COLUMN_NAME` is not NULL'; + . ' AND k.`REFERENCED_COLUMN_NAME` is not NULL' + . ' ORDER BY k.`ORDINAL_POSITION`'; } /** diff --git a/doctrine/dbal/src/Platforms/SQLServer2012Platform.php b/doctrine/dbal/src/Platforms/SQLServer2012Platform.php index d94784d6..4db8f055 100644 --- a/doctrine/dbal/src/Platforms/SQLServer2012Platform.php +++ b/doctrine/dbal/src/Platforms/SQLServer2012Platform.php @@ -1010,7 +1010,8 @@ class SQLServer2012Platform extends AbstractPlatform INNER JOIN sys.objects AS o ON o.OBJECT_ID = fc.referenced_object_id ON f.OBJECT_ID = fc.constraint_object_id WHERE ' . - $this->getTableWhereClause($table, 'SCHEMA_NAME (f.schema_id)', 'OBJECT_NAME (f.parent_object_id)'); + $this->getTableWhereClause($table, 'SCHEMA_NAME (f.schema_id)', 'OBJECT_NAME (f.parent_object_id)') . + ' ORDER BY fc.constraint_column_id'; } /** @@ -1146,9 +1147,7 @@ class SQLServer2012Platform extends AbstractPlatform */ public function getConcatExpression() { - $args = func_get_args(); - - return '(' . implode(' + ', $args) . ')'; + return sprintf('CONCAT(%s)', implode(', ', func_get_args())); } /** diff --git a/doctrine/dbal/src/Platforms/SqlitePlatform.php b/doctrine/dbal/src/Platforms/SqlitePlatform.php index 5dc1747c..16818261 100644 --- a/doctrine/dbal/src/Platforms/SqlitePlatform.php +++ b/doctrine/dbal/src/Platforms/SqlitePlatform.php @@ -920,7 +920,8 @@ class SqlitePlatform extends AbstractPlatform continue; } - $columns = $this->replaceColumn($diff->name, $columns, $oldColumnName, $column); + $oldColumnName = strtolower($oldColumnName); + $columns = $this->replaceColumn($diff->name, $columns, $oldColumnName, $column); if (! isset($newColumnNames[$oldColumnName])) { continue; @@ -934,7 +935,8 @@ class SqlitePlatform extends AbstractPlatform continue; } - $columns = $this->replaceColumn($diff->name, $columns, $oldColumnName, $columnDiff->column); + $oldColumnName = strtolower($oldColumnName); + $columns = $this->replaceColumn($diff->name, $columns, $oldColumnName, $columnDiff->column); if (! isset($newColumnNames[$oldColumnName])) { continue; @@ -1016,7 +1018,7 @@ class SqlitePlatform extends AbstractPlatform private function replaceColumn($tableName, array $columns, $columnName, Column $column): array { $keys = array_keys($columns); - $index = array_search(strtolower($columnName), $keys, true); + $index = array_search($columnName, $keys, true); if ($index === false) { throw SchemaException::columnDoesNotExist($columnName, $tableName); diff --git a/doctrine/dbal/src/Query/QueryBuilder.php b/doctrine/dbal/src/Query/QueryBuilder.php index 246cde1a..6d74d010 100644 --- a/doctrine/dbal/src/Query/QueryBuilder.php +++ b/doctrine/dbal/src/Query/QueryBuilder.php @@ -405,7 +405,7 @@ class QueryBuilder * ->select('u') * ->from('users', 'u') * ->where('u.id = :user_id') - * ->setParameter(':user_id', 1); + * ->setParameter('user_id', 1); * </code> * * @param int|string $key Parameter position or name @@ -434,8 +434,8 @@ class QueryBuilder * ->from('users', 'u') * ->where('u.id = :user_id1 OR u.id = :user_id2') * ->setParameters(array( - * ':user_id1' => 1, - * ':user_id2' => 2 + * 'user_id1' => 1, + * 'user_id2' => 2 * )); * </code> * diff --git a/doctrine/dbal/src/SQL/Parser.php b/doctrine/dbal/src/SQL/Parser.php index 32d306ca..f1ad6617 100644 --- a/doctrine/dbal/src/SQL/Parser.php +++ b/doctrine/dbal/src/SQL/Parser.php @@ -2,6 +2,8 @@ namespace Doctrine\DBAL\SQL; +use Doctrine\DBAL\SQL\Parser\Exception; +use Doctrine\DBAL\SQL\Parser\Exception\RegularExpressionError; use Doctrine\DBAL\SQL\Parser\Visitor; use function array_merge; @@ -10,11 +12,14 @@ use function current; use function implode; use function key; use function next; +use function preg_last_error; use function preg_match; use function reset; use function sprintf; use function strlen; +use const PREG_NO_ERROR; + /** * The SQL parser that focuses on identifying prepared statement parameters. It implements parsing other tokens like * string literals and comments only as a way to not confuse their contents with the the parameter placeholders. @@ -27,17 +32,17 @@ use function strlen; */ final class Parser { - private const ANY = '.'; - private const SPECIAL = '[:\?\'"`\\[\\-\\/]'; + private const SPECIAL_CHARS = ':\?\'"`\\[\\-\\/'; private const BACKTICK_IDENTIFIER = '`[^`]*`'; private const BRACKET_IDENTIFIER = '(?<!\b(?i:ARRAY))\[(?:[^\]])*\]'; private const MULTICHAR = ':{2,}'; private const NAMED_PARAMETER = ':[a-zA-Z0-9_]+'; - private const POSITIONAL_PARAMETER = '\\?'; + private const POSITIONAL_PARAMETER = '(?<!\\?)\\?(?!\\?)'; private const ONE_LINE_COMMENT = '--[^\r\n]*'; private const MULTI_LINE_COMMENT = '/\*([^*]+|\*+[^/*])*\**\*/'; - private const OTHER = '((?!' . self::SPECIAL . ')' . self::ANY . ')+'; + private const SPECIAL = '[' . self::SPECIAL_CHARS . ']'; + private const OTHER = '[^' . self::SPECIAL_CHARS . ']+'; /** @var string */ private $sqlPattern; @@ -70,6 +75,8 @@ final class Parser /** * Parses the given SQL statement + * + * @throws Exception */ public function parse(string $sql, Visitor $visitor): void { @@ -97,6 +104,10 @@ final class Parser reset($patterns); $offset += strlen($matches[0]); + } elseif (preg_last_error() !== PREG_NO_ERROR) { + // @codeCoverageIgnoreStart + throw RegularExpressionError::new(); + // @codeCoverageIgnoreEnd } else { next($patterns); } @@ -107,7 +118,7 @@ final class Parser private function getMySQLStringLiteralPattern(string $delimiter): string { - return $delimiter . '((\\\\' . self::ANY . ')|(?![' . $delimiter . '\\\\])' . self::ANY . ')*' . $delimiter; + return $delimiter . '((\\\\.)|(?![' . $delimiter . '\\\\]).)*' . $delimiter; } private function getAnsiSQLStringLiteralPattern(string $delimiter): string diff --git a/doctrine/dbal/src/SQL/Parser/Exception.php b/doctrine/dbal/src/SQL/Parser/Exception.php new file mode 100644 index 00000000..0c14b358 --- /dev/null +++ b/doctrine/dbal/src/SQL/Parser/Exception.php @@ -0,0 +1,11 @@ +<?php + +declare(strict_types=1); + +namespace Doctrine\DBAL\SQL\Parser; + +use Throwable; + +interface Exception extends Throwable +{ +} diff --git a/doctrine/dbal/src/SQL/Parser/Exception/RegularExpressionError.php b/doctrine/dbal/src/SQL/Parser/Exception/RegularExpressionError.php new file mode 100644 index 00000000..81ae2157 --- /dev/null +++ b/doctrine/dbal/src/SQL/Parser/Exception/RegularExpressionError.php @@ -0,0 +1,19 @@ +<?php + +declare(strict_types=1); + +namespace Doctrine\DBAL\SQL\Parser\Exception; + +use Doctrine\DBAL\SQL\Parser\Exception; +use RuntimeException; + +use function preg_last_error; +use function preg_last_error_msg; + +class RegularExpressionError extends RuntimeException implements Exception +{ + public static function new(): self + { + return new self(preg_last_error_msg(), preg_last_error()); + } +} diff --git a/doctrine/dbal/src/Schema/OracleSchemaManager.php b/doctrine/dbal/src/Schema/OracleSchemaManager.php index e24f79ff..13c88524 100644 --- a/doctrine/dbal/src/Schema/OracleSchemaManager.php +++ b/doctrine/dbal/src/Schema/OracleSchemaManager.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Types\Type; use function array_change_key_case; use function array_values; use function assert; +use function is_string; use function preg_match; use function str_replace; use function strpos; @@ -68,7 +69,7 @@ class OracleSchemaManager extends AbstractSchemaManager $keyName = strtolower($tableIndex['name']); $buffer = []; - if (strtolower($tableIndex['is_primary']) === 'p') { + if ($tableIndex['is_primary'] === 'P') { $keyName = 'primary'; $buffer['primary'] = true; $buffer['non_unique'] = false; @@ -108,7 +109,9 @@ class OracleSchemaManager extends AbstractSchemaManager } // Default values returned from database sometimes have trailing spaces. - $tableColumn['data_default'] = trim($tableColumn['data_default']); + if (is_string($tableColumn['data_default'])) { + $tableColumn['data_default'] = trim($tableColumn['data_default']); + } if ($tableColumn['data_default'] === '' || $tableColumn['data_default'] === 'NULL') { $tableColumn['data_default'] = null; diff --git a/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php b/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php index e353b53e..abc06af4 100644 --- a/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php +++ b/doctrine/dbal/src/Schema/PostgreSQLSchemaManager.php @@ -21,7 +21,6 @@ use function preg_match; use function preg_replace; use function sprintf; use function str_replace; -use function strlen; use function strpos; use function strtolower; use function trim; @@ -106,6 +105,8 @@ SQL $this->determineExistingSchemaSearchPaths(); } + assert($this->existingSchemaPaths !== null); + return $this->existingSchemaPaths; } @@ -345,16 +346,22 @@ SQL $matches = []; $autoincrement = false; - if (preg_match("/^nextval\('(.*)'(::.*)?\)$/", $tableColumn['default'], $matches) === 1) { + + if ( + $tableColumn['default'] !== null + && preg_match("/^nextval\('(.*)'(::.*)?\)$/", $tableColumn['default'], $matches) === 1 + ) { $tableColumn['sequence'] = $matches[1]; $tableColumn['default'] = null; $autoincrement = true; } - if (preg_match("/^['(](.*)[')]::/", $tableColumn['default'], $matches) === 1) { - $tableColumn['default'] = $matches[1]; - } elseif (preg_match('/^NULL::/', $tableColumn['default']) === 1) { - $tableColumn['default'] = null; + if ($tableColumn['default'] !== null) { + if (preg_match("/^['(](.*)[')]::/", $tableColumn['default'], $matches) === 1) { + $tableColumn['default'] = $matches[1]; + } elseif (preg_match('/^NULL::/', $tableColumn['default']) === 1) { + $tableColumn['default'] = null; + } } $length = $tableColumn['length'] ?? null; @@ -378,7 +385,8 @@ SQL $dbType = strtolower($tableColumn['type']); if ( - strlen($tableColumn['domain_type']) > 0 + $tableColumn['domain_type'] !== null + && $tableColumn['domain_type'] !== '' && ! $this->_platform->hasDoctrineTypeMappingFor($tableColumn['type']) ) { $dbType = strtolower($tableColumn['domain_type']); @@ -518,7 +526,7 @@ SQL */ private function fixVersion94NegativeNumericDefaultValue($defaultValue) { - if (strpos($defaultValue, '(') === 0) { + if ($defaultValue !== null && strpos($defaultValue, '(') === 0) { return trim($defaultValue, '()'); } diff --git a/doctrine/dbal/src/Schema/SQLServerSchemaManager.php b/doctrine/dbal/src/Schema/SQLServerSchemaManager.php index a448dd14..f1836fc5 100644 --- a/doctrine/dbal/src/Schema/SQLServerSchemaManager.php +++ b/doctrine/dbal/src/Schema/SQLServerSchemaManager.php @@ -6,7 +6,6 @@ use Doctrine\DBAL\Exception; use Doctrine\DBAL\Platforms\SQLServer2012Platform; use Doctrine\DBAL\Types\Type; use Doctrine\Deprecations\Deprecation; -use PDOException; use function assert; use function count; @@ -254,12 +253,6 @@ SQL try { $tableIndexes = $this->_conn->fetchAllAssociative($sql); - } catch (PDOException $e) { - if ($e->getCode() === 'IMSSP') { - return []; - } - - throw $e; } catch (Exception $e) { if (strpos($e->getMessage(), 'SQLSTATE [01000, 15472]') === 0) { return []; diff --git a/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php b/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php index 8cff50f9..86a2842c 100644 --- a/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php +++ b/doctrine/dbal/src/Tools/Console/Command/ReservedWordsCommand.php @@ -133,6 +133,8 @@ EOT /** * {@inheritdoc} * + * @return int + * * @throws Exception */ protected function execute(InputInterface $input, OutputInterface $output) diff --git a/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php b/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php index 4ccb3260..875f2a20 100644 --- a/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php +++ b/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php @@ -59,6 +59,8 @@ EOT /** * {@inheritdoc} * + * @return int + * * @throws Exception */ protected function execute(InputInterface $input, OutputInterface $output) |