The Oracle (OCI8) driver uses assert to verify the result from oci_parse.
By default (since PHP7), assert is disabled in production environments, which means the validation is never executed in prod. Unlike other drivers that handle this check by throwing exceptions, the OCI8 driver relies on assert, resulting in warnings in the log, and no way of catching the lost connection
In production, if oci_parse fails (e.g., due to a connection issue), the assert statement is bypassed, leading to PHP warnings rather than controlled exceptions. This results in the following warning:
PHP Warning: oci_parse(): ORA-03114: not connected to ORACLE in /srv/app/vendor/doctrine/dbal/src/Driver/OCI8/Connection.php on line 57
Expected behavior
The Oracle driver should handle oci_parse failures consistently with other drivers by checking the result and throwing an appropriate exception if oci_parse fails. This would ensure reliable error handling across all environments
How to reproduce
Disable assertions in your production-like environment
Use the OCI8 driver to connect to an Oracle database
Trigger a connection issue (e.g., disconnect or shutdown the Oracle server)
Observe that instead of an exception, a PHP warning is issued, and the error is not handled as expected
Bug Report
Summary
The Oracle (OCI8) driver uses assert to verify the result from oci_parse.
By default (since PHP7), assert is disabled in production environments, which means the validation is never executed in prod. Unlike other drivers that handle this check by throwing exceptions, the OCI8 driver relies on assert, resulting in warnings in the log, and no way of catching the lost connection
Current behavior
In production, if oci_parse fails (e.g., due to a connection issue), the assert statement is bypassed, leading to PHP warnings rather than controlled exceptions. This results in the following warning:
Expected behavior
The Oracle driver should handle oci_parse failures consistently with other drivers by checking the result and throwing an appropriate exception if oci_parse fails. This would ensure reliable error handling across all environments
How to reproduce