.. _security-dontechoerror: .. _don't-echo-error: Don't Echo Error ++++++++++++++++ It is recommended to avoid displaying `error `_ messages directly to the browser. PHP's uses the ``display_errors`` directive to control display of errors to the browser. This must be kept to ``off`` when in production. `Error `_ messages should be logged, but not displayed. .. code-block:: php See also `Error reporting `_ and `List of php.ini directives `_. Suggestions ___________ * Remove any echo, print, printf() call built with error messages from an exception, or external source. Specs _____ +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Security/DontEchoError | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`CE `, :ref:`CI-checks `, :ref:`Changed Behavior `, :ref:`Security ` | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.8.7 | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Critical | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Instant (5 mins) | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | High | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Examples | :ref:`case-churchcrm-security-dontechoerror`, :ref:`case-phpdocumentor-security-dontechoerror` | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Community Edition `_, `Exakat Cloud `_ | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+