From 278b643f2a5ec1b92fd60b2d7dac034f3a52ea4e Mon Sep 17 00:00:00 2001 From: Greg Sherwood Date: Fri, 20 Dec 2019 14:33:58 +1100 Subject: [PATCH] Changelog + rename + message change for #2750 --- package.xml | 10 ++++++---- ...dard.xml => DisallowRequestSuperglobalStandard.xml} | 4 ++-- ...alSniff.php => DisallowRequestSuperglobalSniff.php} | 6 +++--- ...Test.inc => DisallowRequestSuperglobalUnitTest.inc} | 0 ...Test.php => DisallowRequestSuperglobalUnitTest.php} | 4 ++-- 5 files changed, 13 insertions(+), 11 deletions(-) rename src/Standards/Generic/Docs/PHP/{DisallowRequestSuperGlobalStandard.xml => DisallowRequestSuperglobalStandard.xml} (51%) rename src/Standards/Generic/Sniffs/PHP/{DisallowRequestSuperGlobalSniff.php => DisallowRequestSuperglobalSniff.php} (84%) rename src/Standards/Generic/Tests/PHP/{DisallowRequestSuperGlobalUnitTest.inc => DisallowRequestSuperglobalUnitTest.inc} (100%) rename src/Standards/Generic/Tests/PHP/{DisallowRequestSuperGlobalUnitTest.php => DisallowRequestSuperglobalUnitTest.php} (90%) diff --git a/package.xml b/package.xml index 00a16b5f89..cb2c45f69b 100644 --- a/package.xml +++ b/package.xml @@ -28,6 +28,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> - The PHP 7.4 numeric separator backfill now works correctly for more float formats - The PHP 7.4 numeric separator backfill is no longer run on PHP versions 7.4.0 or greater + - Added Generic.PHP.DisallowRequestSuperglobal to ban the use of the $_REQUEST superglobal + -- Thanks to Morerice for the contribution - Fixed bug #2688 : Case statements not tokenized correctly when switch is contained within ternary - Fixed bug #2698 : PHPCS throws errors determining auto report width when shell_exec is disabled -- Thanks to Matthew Peveler for the patch @@ -249,7 +251,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> - + @@ -353,7 +355,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> - + @@ -613,8 +615,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> - - + + diff --git a/src/Standards/Generic/Docs/PHP/DisallowRequestSuperGlobalStandard.xml b/src/Standards/Generic/Docs/PHP/DisallowRequestSuperglobalStandard.xml similarity index 51% rename from src/Standards/Generic/Docs/PHP/DisallowRequestSuperGlobalStandard.xml rename to src/Standards/Generic/Docs/PHP/DisallowRequestSuperglobalStandard.xml index 5dfea56fd3..f94769427c 100644 --- a/src/Standards/Generic/Docs/PHP/DisallowRequestSuperGlobalStandard.xml +++ b/src/Standards/Generic/Docs/PHP/DisallowRequestSuperglobalStandard.xml @@ -1,7 +1,7 @@ - + diff --git a/src/Standards/Generic/Sniffs/PHP/DisallowRequestSuperGlobalSniff.php b/src/Standards/Generic/Sniffs/PHP/DisallowRequestSuperglobalSniff.php similarity index 84% rename from src/Standards/Generic/Sniffs/PHP/DisallowRequestSuperGlobalSniff.php rename to src/Standards/Generic/Sniffs/PHP/DisallowRequestSuperglobalSniff.php index 6ef89f7213..d5c7ddb724 100644 --- a/src/Standards/Generic/Sniffs/PHP/DisallowRequestSuperGlobalSniff.php +++ b/src/Standards/Generic/Sniffs/PHP/DisallowRequestSuperglobalSniff.php @@ -1,6 +1,6 @@ * @copyright 2006-2019 Squiz Pty Ltd (ABN 77 084 670 600) @@ -12,7 +12,7 @@ use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; -class DisallowRequestSuperGlobalSniff implements Sniff +class DisallowRequestSuperglobalSniff implements Sniff { @@ -45,7 +45,7 @@ public function process(File $phpcsFile, $stackPtr) return; } - $error = 'The $_REQUEST super global should not be used. Use $_GET, $_POST or $_COOKIE instead'; + $error = 'The $_REQUEST superglobal should not be used; use $_GET, $_POST, or $_COOKIE instead'; $phpcsFile->addError($error, $stackPtr, 'Found'); }//end process() diff --git a/src/Standards/Generic/Tests/PHP/DisallowRequestSuperGlobalUnitTest.inc b/src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.inc similarity index 100% rename from src/Standards/Generic/Tests/PHP/DisallowRequestSuperGlobalUnitTest.inc rename to src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.inc diff --git a/src/Standards/Generic/Tests/PHP/DisallowRequestSuperGlobalUnitTest.php b/src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.php similarity index 90% rename from src/Standards/Generic/Tests/PHP/DisallowRequestSuperGlobalUnitTest.php rename to src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.php index 63b49a8e44..7ece551201 100644 --- a/src/Standards/Generic/Tests/PHP/DisallowRequestSuperGlobalUnitTest.php +++ b/src/Standards/Generic/Tests/PHP/DisallowRequestSuperglobalUnitTest.php @@ -1,6 +1,6 @@ * @copyright 2006-2019 Squiz Pty Ltd (ABN 77 084 670 600) @@ -10,7 +10,7 @@ use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; -class DisallowRequestSuperGlobalUnitTest extends AbstractSniffUnitTest +class DisallowRequestSuperglobalUnitTest extends AbstractSniffUnitTest {