Problem/Motivation
Using unserialize() method which is insecure.
Steps to reproduce
1. Run PHP coding standard to regenerate the report
the report is generated using following command
vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml address/
Report:
FILE: address/address.module
---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
68 | WARNING | Unused variable $delta.
---------------------------------------------------------------------------------------------
FILE: address/src/Element/Address.php
------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------
254 | WARNING | Unused variable $field_index.
------------------------------------------------------------------------------------------------------
FILE: address/src/Element/ZoneTerritory.php
--------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is CommerceGuys\Addressing\AddressFormat\AddressField.
--------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Element/Zone.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Html.
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/Field/FieldFormatter/AddressPlainFormatter.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------
13 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldDefinitionInterface.
----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/Field/FieldFormatter/CountryDefaultFormatter.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldDefinitionInterface.
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/Field/FieldFormatter/ZoneDefaultFormatter.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------------------
188 | ERROR | The array declaration extends to column 97 (the limit is 80). The array content should be split up over multiple lines
204 | ERROR | The array declaration extends to column 118 (the limit is 80). The array content should be split up over multiple lines
---------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/Field/FieldFormatter/AddressDefaultFormatter.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
15 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldDefinitionInterface.
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/Field/FieldType/ZoneItemList.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
21 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
-------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/Field/FieldType/CountryItem.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldStorageDefinitionInterface.
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/Field/FieldWidget/CountryDefaultWidget.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldDefinitionInterface.
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/Field/FieldWidget/AddressDefaultWidget.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldDefinitionInterface.
128 | ERROR | [ ] The array declaration extends to column 86 (the limit is 80). The array content should be split up over multiple lines
------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/views/filter/AdministrativeArea.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 7 LINES
-------------------------------------------------------------------------------------------------------------------------------------------
11 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\address\LabelHelper.
265 | ERROR | [ ] The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple lines
268 | ERROR | [ ] The array declaration extends to column 95 (the limit is 80). The array content should be split up over multiple lines
280 | ERROR | [ ] The array declaration extends to column 91 (the limit is 80). The array content should be split up over multiple lines
292 | ERROR | [ ] The array declaration extends to column 91 (the limit is 80). The array content should be split up over multiple lines
344 | ERROR | [ ] The array declaration extends to column 84 (the limit is 80). The array content should be split up over multiple lines
432 | ERROR | [ ] The array declaration extends to column 102 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/views/sort/Country.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is CommerceGuys\Addressing\Country\CountryRepositoryInterface.
----------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Plugin/diff/Field/AddressFieldBuilder.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Field\FieldItemListInterface.
29 | ERROR | [ ] The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple lines
-----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/Commands/SanitizeAddress.php
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
159 | ERROR | Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
159 | ERROR | The text '@deprecated Use $options['allowlist-fields'] instead.' does not match the standard format: @deprecated in %deprecation-version% and is removed from %removal-version%. %extra-info%.
159 | ERROR | Each @deprecated tag must have a @see tag immediately following it
239 | WARNING | Line exceeds 80 characters; contains 97 characters
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/src/LabelHelper.php
------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------------
10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is CommerceGuys\Addressing\AddressFormat\AddressFormat.
66 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/address.install
----------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
10 | WARNING | [x] Unused use statement
12 | WARNING | [x] Unused use statement
29 | ERROR | [x] Expected 1 blank line after function; 2 found
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------
FILE: address/address.tokens.inc
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\ContentEntityInterface.
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------
FILE: address/tests/src/Unit/Plugin/Validation/Constraint/CountryConstraintValidatorTest.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------
38 | ERROR | The array declaration extends to column 83 (the limit is 80). The array content should be split up over multiple lines
-------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/tests/src/FunctionalJavascript/AddressDefaultWidgetTest.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 12 WARNINGS AFFECTING 16 LINES
------------------------------------------------------------------------------------------------------------------------------------------
190 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
214 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
261 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
288 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
338 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
400 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
422 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
437 | ERROR | The array declaration extends to column 88 (the limit is 80). The array content should be split up over multiple lines
438 | ERROR | The array declaration extends to column 109 (the limit is 80). The array content should be split up over multiple lines
481 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
494 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
553 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
574 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
608 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
670 | ERROR | The array declaration extends to column 112 (the limit is 80). The array content should be split up over multiple lines
672 | ERROR | The array declaration extends to column 177 (the limit is 80). The array content should be split up over multiple lines
------------------------------------------------------------------------------------------------------------------------------------------
FILE: address/tests/modules/address_test/address_test.routing.yml
----------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------------
7 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
15 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
----------------------------------------------------------------------------------------------------------------------------------
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes