Dbal: Connection ping method can trigger uncaught PDOExceptions

Created on 5 Jul 2017  路  2Comments  路  Source: doctrine/dbal

Reading the ping method phpdoc it's not immediately clear to me if the method should allow driver exceptions to bubble up.

My expectation was that this method would always return true/false based on the success of connecting to the database and performing a dummy query.

When having a connection timeout or close it's possible to encounter PDOException instead.

Bug Connecting Connections Hacktoberfest

Most helpful comment

@gregl83 this should be fixed rather than documented as a possible crash: a ping operation failing due to invalid connection information should simply return false

All 2 comments

@gregl83 this should be fixed rather than documented as a possible crash: a ping operation failing due to invalid connection information should simply return false

@Ocramius my sentiment as well.

Was this page helpful?
0 / 5 - 0 ratings