1

In prod env when error occurured symfony displays a standard error page. This is the standard default framework error page:

But when PDO can't connect to database symfony display this error to the client:

    Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known' in /homepages/35/d619429344/htdocs/mcg/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43 Stack trace: #0 /homepages/35/d619429344/htdocs/mcg/web/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=db63...', 'dbo632759072', 'mgm_mgm', Array) #1 ...

PDO exeptions:

I can't display this error to the client for security reason. Any ideas on how to disable these messages and redirect to an error page like other error ?

helmis.m
  • 234
  • 1
  • 18

1 Answers1

3

You should have display_errors = off in your PHP.ini anyway to avoid this problem. Errors that reveal details like these come from many places, in addition to PDO.

helmis.m
  • 234
  • 1
  • 18