Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP warning on unknown database with Doctrine DBAL 2.13.x #4645

Closed
mbrodala opened this issue May 12, 2021 · 4 comments · Fixed by #4647
Closed

PHP warning on unknown database with Doctrine DBAL 2.13.x #4645

mbrodala opened this issue May 12, 2021 · 4 comments · Fixed by #4647

Comments

@mbrodala
Copy link

BC Break Report

Q A
BC Break yes
Version 2.13.1

Summary

Connection attempts to a missing database lead to a PHP warning.

Previous behaviour

No warning was shown.

Current behavior

A PHP warning is issued:

PHP Warning: mysqli::real_connect(): (HY000/1049): Unknown database ...

How to reproduce

  1. Do a connection to a missing database.
  2. With Doctrine DBAL 2.11.x no error occurs
  3. With Doctrine DBAL 2.13.x a PHP warning occurs

Also see Nimut/testing-framework#136 and TYPO3/testing-framework#233 for more specific examples.

@mbrodala mbrodala changed the title PHP Warning: mysqli::real_connect(): (HY000/1049): Unknown database with Doctrine DBAL 2.13.x PHP warning on unknown database with Doctrine DBAL 2.13.x May 12, 2021
@morozov
Copy link
Member

morozov commented May 12, 2021

Could be solved by backporting c9ce80a. This will also solve the test failure on non-Linux operating systems:

1) Doctrine\Tests\DBAL\Driver\Mysqli\MysqliConnectionTest::testRestoresErrorHandlerOnException
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'Network is unreachable'
+'Permission denied'

tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php:56

morozov added a commit to morozov/dbal that referenced this issue May 12, 2021
@morozov morozov added this to the 2.13.2 milestone May 12, 2021
@morozov morozov added the Bug label May 12, 2021
morozov added a commit to morozov/dbal that referenced this issue May 12, 2021
morozov added a commit to morozov/dbal that referenced this issue May 13, 2021
morozov added a commit to morozov/dbal that referenced this issue May 13, 2021
morozov added a commit to morozov/dbal that referenced this issue May 13, 2021
morozov added a commit that referenced this issue May 13, 2021
[GH-4645] Use error suppression instead of an error handler in MySQLi Connection
@bmack
Copy link

bmack commented May 14, 2021

@morozov Thank you for this super quick fix 🙇

@morozov
Copy link
Member

morozov commented May 14, 2021

@bmack, you're welcome. Closed via #4647.

@morozov morozov closed this as completed May 14, 2021
derrabus added a commit to derrabus/dbal that referenced this issue Jun 5, 2021
* 2.13.x:
  Bump doctrine/coding-standard
  [doctrineGH-4643] Fix SQLServerPlatform::quoteIdentifier()
  [doctrineGH-4645] Use error suppression instead of an error handler in MySQLi Connection
  Rewrote `DriverManagerTest` replica/shards test scenarios to verify whole data structure equality
  Add type-inference tests to github actions, so that we test also that types match up
  Add warnings in docblocks
  Rework the caching documentation
  Fix doctrine#4637 by duplicating the type definition for `DriverManager::getConnection($args)` params
derrabus added a commit to derrabus/dbal that referenced this issue Jun 5, 2021
* 2.13.x:
  Bump doctrine/coding-standard
  [doctrineGH-4643] Fix SQLServerPlatform::quoteIdentifier()
  [doctrineGH-4645] Use error suppression instead of an error handler in MySQLi Connection
  Rewrote `DriverManagerTest` replica/shards test scenarios to verify whole data structure equality
  Add type-inference tests to github actions, so that we test also that types match up
  Add warnings in docblocks
  Rework the caching documentation
  Fix doctrine#4637 by duplicating the type definition for `DriverManager::getConnection($args)` params
derrabus added a commit to derrabus/dbal that referenced this issue Jun 5, 2021
* 2.13.x:
  Bump doctrine/coding-standard
  [doctrineGH-4643] Fix SQLServerPlatform::quoteIdentifier()
  [doctrineGH-4645] Use error suppression instead of an error handler in MySQLi Connection
  Rewrote `DriverManagerTest` replica/shards test scenarios to verify whole data structure equality
  Add type-inference tests to github actions, so that we test also that types match up
  Add warnings in docblocks
  Rework the caching documentation
  Fix doctrine#4637 by duplicating the type definition for `DriverManager::getConnection($args)` params
derrabus added a commit to derrabus/dbal that referenced this issue Jun 5, 2021
* 2.13.x:
  Bump doctrine/coding-standard
  [doctrineGH-4643] Fix SQLServerPlatform::quoteIdentifier()
  [doctrineGH-4645] Use error suppression instead of an error handler in MySQLi Connection
  Rewrote `DriverManagerTest` replica/shards test scenarios to verify whole data structure equality
  Add type-inference tests to github actions, so that we test also that types match up
  Add warnings in docblocks
  Rework the caching documentation
  Fix doctrine#4637 by duplicating the type definition for `DriverManager::getConnection($args)` params
derrabus added a commit to derrabus/dbal that referenced this issue Jun 6, 2021
* 2.13.x:
  Bump doctrine/coding-standard
  [doctrineGH-4643] Fix SQLServerPlatform::quoteIdentifier()
  [doctrineGH-4645] Use error suppression instead of an error handler in MySQLi Connection
  Rewrote `DriverManagerTest` replica/shards test scenarios to verify whole data structure equality
  Add type-inference tests to github actions, so that we test also that types match up
  Add warnings in docblocks
  Rework the caching documentation
  Fix doctrine#4637 by duplicating the type definition for `DriverManager::getConnection($args)` params
derrabus added a commit to derrabus/dbal that referenced this issue Jun 7, 2021
* 2.13.x:
  Bump doctrine/coding-standard
  [doctrineGH-4643] Fix SQLServerPlatform::quoteIdentifier()
  [doctrineGH-4645] Use error suppression instead of an error handler in MySQLi Connection
  Rewrote `DriverManagerTest` replica/shards test scenarios to verify whole data structure equality
  Add type-inference tests to github actions, so that we test also that types match up
  Add warnings in docblocks
  Rework the caching documentation
  Fix doctrine#4637 by duplicating the type definition for `DriverManager::getConnection($args)` params

Signed-off-by: Alexander M. Turek <me@derrabus.de>
derrabus added a commit to derrabus/dbal that referenced this issue Jun 7, 2021
* 2.13.x:
  Bump doctrine/coding-standard
  [doctrineGH-4643] Fix SQLServerPlatform::quoteIdentifier()
  [doctrineGH-4645] Use error suppression instead of an error handler in MySQLi Connection
  Rewrote `DriverManagerTest` replica/shards test scenarios to verify whole data structure equality
  Add type-inference tests to github actions, so that we test also that types match up
  Add warnings in docblocks
  Rework the caching documentation
  Fix doctrine#4637 by duplicating the type definition for `DriverManager::getConnection($args)` params

Signed-off-by: Alexander M. Turek <me@derrabus.de>
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants