PHP is set to print error messages into the page

tx0/php:errors-displayedstrictwarningsecurity/sensitive-datadepth fastsecurity, cwe-209

What it finds

ini_set('display_errors', '1'): error messages printed into the page show paths, queries and values to every visitor. Errors belong in a log in production.

From the rule's source, errors_displayed.rs.

Example from the rule's tests
<?phpini_set('display_errors', '1');tx0 reports: error messages are printed into the pageini_set('display_errors', '0');ini_set('log_errors', '1');
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/php:errors-displayed" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/php:errors-displayed] reason="..."

tx0 explain tx0/php:errors-displayed shows the same in the terminal. Found a false positive? Report it.