Debugging output such as var_dump or phpinfo is printed

tx0/php:debug-outputrecommendedwarningsecurity/configurationdepth fastsecurity, cwe-489

What it finds

var_dump($user), print_r($request) and phpinfo() left in code print internals into the page: configuration, paths, and the contents of objects, which helps an attacker and breaks the output. print_r and var_export with true as second argument return the text instead and are left alone.

From the rule's source, debug_output.rs.

Example from the rule's tests
<?phpfunction show($user){    var_dump($user);tx0 reports: var_dump prints debugging output    print_r($user);tx0 reports: print_r prints debugging output    $text = print_r($user, true);    phpinfo();tx0 reports: phpinfo prints debugging output    return $text;}
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 recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/php:debug-output" = "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:debug-output] reason="..."

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