FILE: C:\xampp\htdocs\drupal-9\web\modules\contrib\eu-cookie-compliance\src\EventSubscriber\EuCookieComplianceConfigEventsSubscriber.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------------------------------------------
50 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
59 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
64 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\drupal-9\web\modules\contrib\eu-cookie-compliance\src\Form\EuCookieComplianceConfigForm.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
736 | WARNING | Line exceeds 80 characters; contains 94 characters
-----------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\drupal-9\web\modules\contrib\eu-cookie-compliance\src\Plugin\Block\CookieSettingsButtonBlock.php
----------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------
31 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\drupal-9\web\modules\contrib\eu-cookie-compliance\src\Plugin\migrate\source\EuCookieCategory.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
51 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
-------------------------------------------------------------------------------------------------------------------------------------------

Time: 2.87 secs; Memory: 20MB

Command icon 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

anoopsingh92 created an issue. See original summary.

anoopsingh92’s picture

Assigned: anoopsingh92 » Unassigned
Status: Active » Needs review
StatusFileSize
new6.08 KB

Please review this patch.

svenryen’s picture

Thanks, I'll take a look later.

svenryen’s picture

Status: Needs review » Needs work

This patch needs work. I appreciate your initiative, but it would be nice if the code was tested before the patch was uploaded.

  1. +++ b/src/EventSubscriber/EuCookieComplianceConfigEventsSubscriber.php
    @@ -56,12 +56,12 @@ class EuCookieComplianceConfigEventsSubscriber implements EventSubscriberInterfa
    +            $this->service('file.repository')
    

    Method 'service' not found in EuCookieComplianceConfigEventsSubscriber.

  2. +++ b/src/EventSubscriber/EuCookieComplianceConfigEventsSubscriber.php
    @@ -56,12 +56,12 @@ class EuCookieComplianceConfigEventsSubscriber implements EventSubscriberInterfa
    +            $this->service('file.repository')
    

    Same here.

  3. +++ b/src/EventSubscriber/EuCookieComplianceConfigEventsSubscriber.php
    @@ -56,12 +56,12 @@ class EuCookieComplianceConfigEventsSubscriber implements EventSubscriberInterfa
    +          $this->messenger()
    

    And messenger is also not a function in the class.

  4. +++ b/src/EventSubscriber/EuCookieComplianceConfigEventsSubscriber.php
    @@ -100,7 +100,7 @@ class EuCookieComplianceConfigEventsSubscriber implements EventSubscriberInterfa
    +          @[$script, $attach_name] = explode('%7C', $script);
    

    [] for splitting arrays isn't supported in PHP 7.0.

  5. +++ b/src/Plugin/Block/CookieSettingsButtonBlock.php
    +++ b/src/Plugin/Block/CookieSettingsButtonBlock.php
    @@ -28,7 +28,7 @@ class CookieSettingsButtonBlock extends BlockBase {
    
    @@ -28,7 +28,7 @@ class CookieSettingsButtonBlock extends BlockBase {
    +    $config = $this->config('eu_cookie_compliance.settings');
    

    Method 'config' not found in CookieSettingsButtonBlock.

anoopsingh92’s picture

svenryen’s picture

@anoopsingh92 will you be fixing your patch, or should I take care of it?

anoopsingh92’s picture

Hi @svenryen, I apologize for waiting. If are doing then You can go ahead. Actually, i am not giving time for contribution from last two days.

anoopsingh92’s picture

Status: Needs work » Needs review
StatusFileSize
new2.07 KB

I have re-rolled the patch. Please review it, But the dependency injection is still pending. In this patch, I have fixed only these issues.

FILE: C:\xampp\htdocs\drupal-9\web\modules\contrib\eu-cookie-compliance\src\Plugin\migrate\source\EuCookieCategory.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
51 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
-------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\drupal-9\web\modules\contrib\eu-cookie-compliance\src\Form\EuCookieComplianceConfigForm.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
736 | WARNING | Line exceeds 80 characters; contains 94 characters
-----------------------------------------------------------------------------------------------------------------

Thanks

anoopsingh92’s picture

I am not sure whether this dependency injection will work or not, That's why I have not added to this patch.

use Drupal\Core\Messenger\MessengerInterface;

class MyModuleService {

  /**
   * The Messenger service.
   *
   * @var \Drupal\Core\Messenger\MessengerInterface
   */
  protected $messenger;

  /**
   * MyModuleService constructor.
   *
   * @param \Drupal\Core\Messenger\MessengerInterface $messenger
   *   The messenger service.
   */
svenryen’s picture

Thanks for your updated patch, I'll take a look.

When you're not sure if your patch will work or not, it's nice if you can set up a test site with this module installed, and confirm that your changes don't crash the code. Please test your patches locally before adding them to the issue queue. We risk introducing bugs in the code when you're not testing locally.

svenryen’s picture

Status: Needs review » Fixed
anoopsingh92’s picture

Yes, Sure @svenryen. Thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.