From c746bf365d0c90a4f1ccc7c40f2d3125bb144e00 Mon Sep 17 00:00:00 2001 From: gogdzl <diego.rodrigues@automattic.com> Date: Tue, 17 Sep 2024 13:26:47 -0700 Subject: [PATCH 1/2] Add documentation for WordPress.PHP.DevelopmentFunctions --- .../Docs/PHP/DevelopmentFunctionsStandard.xml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 WordPress/Docs/PHP/DevelopmentFunctionsStandard.xml diff --git a/WordPress/Docs/PHP/DevelopmentFunctionsStandard.xml b/WordPress/Docs/PHP/DevelopmentFunctionsStandard.xml new file mode 100644 index 000000000..ea2202b71 --- /dev/null +++ b/WordPress/Docs/PHP/DevelopmentFunctionsStandard.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<documentation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://phpcsstandards.github.io/PHPCSDevTools/phpcsdocs.xsd" + title="Development Functions" + > + <standard> + <![CDATA[ + Debug code should not normally be used in production. + + Typically, this rule verifies if function calls to the PHP native `error_log()`, `var_dump()`, `var_export()`, `print_r()`, `trigger_error()`, `set_error_handler()`, `debug_backtrace`, `debug_print_backtrace` and `wp_debug_backtrace_summary()` functions are present in the code. + ]]> + </standard> + <code_comparison> + <code title="Valid: (Not) using var_dump()."> + <![CDATA[ +// var_dump() should not be used. + ]]> + </code> + <code title="Invalid: Calling the PHP native `var_dump()` function."> + <![CDATA[ +var_dump( $bar ); + ]]> + </code> + </code_comparison> + <standard> + <![CDATA[ + Please refrain from using functions that can lead to full path disclosure. + + Typically, this rule verifies if function calls to the PHP native `error_reporting()` and `phpinfo()` functions are present in the code. + ]]> + </standard> + <code_comparison> + <code title="Valid: (Not) using `phpinfo()`."> + <![CDATA[ +// php_info() should not be used. + ]]> + </code> + <code title="Invalid: Calling the PHP native `phpinfo()` function."> + <![CDATA[ +phpinfo(); + ]]> + </code> + </code_comparison> +</documentation> From 28f5a163a3016fb50830066030438fbe9e594d24 Mon Sep 17 00:00:00 2001 From: gogdzl <diego.rodrigues@automattic.com> Date: Tue, 17 Sep 2024 15:04:32 -0700 Subject: [PATCH 2/2] Add em tag --- WordPress/Docs/PHP/DevelopmentFunctionsStandard.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WordPress/Docs/PHP/DevelopmentFunctionsStandard.xml b/WordPress/Docs/PHP/DevelopmentFunctionsStandard.xml index ea2202b71..a4761201f 100644 --- a/WordPress/Docs/PHP/DevelopmentFunctionsStandard.xml +++ b/WordPress/Docs/PHP/DevelopmentFunctionsStandard.xml @@ -18,7 +18,7 @@ </code> <code title="Invalid: Calling the PHP native `var_dump()` function."> <![CDATA[ -var_dump( $bar ); +<em>var_dump( $bar );</em> ]]> </code> </code_comparison> @@ -37,7 +37,7 @@ var_dump( $bar ); </code> <code title="Invalid: Calling the PHP native `phpinfo()` function."> <![CDATA[ -phpinfo(); +<em>phpinfo();</em> ]]> </code> </code_comparison>