Problem/Motivation
Getting following error/warnings.
FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\representative_image\src\Plugin\Field\FieldFormatter\EntityReferenceRepresentativeImage.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------
82 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
----------------------------------------------------------------------------------------------------------------------------------------------------
FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\representative_image\src\Plugin\migrate\source\FieldConfig.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
42 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
-------------------------------------------------------------------------------------------------------------------------------------------
Time: 421ms; Memory: 12MB
Steps to reproduce
Run following command
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/representative_image/
Proposed resolution
Above error/warnings need to be fixed
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 3349232-18.patch | 3.4 KB | nitin_lama |
| #14 | Screenshot 2024-02-14 161619.png | 12.2 KB | shank115 |
| #13 | phpcs_fix.patch | 1.95 KB | Shreyas gowda |
| #11 | fix_coding_standard-3349232-11.patch | 2.8 KB | Neeraj333 |
| #2 | 3349232-2.patch | 2.83 KB | samitk |
Issue fork representative_image-3349232
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
samitk commentedAbove errors/warnings has been fixed.
Comment #4
rassoni commentedComment #6
sagartiwari commentedComment #7
sagartiwari commentedComment #9
shivam_tiwari commentedComment #10
avpadernoThe tests are failing for a reason. See the plain diff of the latest MR created.
Comment #11
Neeraj333 commentedComment #13
Shreyas gowda commentedComment #14
shank115 commentedI applied the patch provided in #13 and it applied successfully.
Comment #15
zkhan.aamir commentedRemaining issues after patch #13.
Comment #16
zkhan.aamir commentedIssue summary updated.
Comment #17
nitin_lamaComment #18
nitin_lamaProviding updated patch.
Comment #19
nitin_lamaPlease review. Thanks.
Comment #20
nitin_lama