Problem/Motivation

Wrong instance passed to the constructor of SocialEmbedHelper.

TypeError: Argument 1 passed to Drupal\social_embed\Service\SocialEmbedHelper::__construct() must be an instance of Drupal\Component\Uuid\Php, instance of Drupal\Component\Uuid\Pecl given in Drupal\social_embed\Service\SocialEmbedHelper->__construct()

SocialEmbedHelper expects Drupal\Component\Uuid\Php class because that is what core service "uuid" offers.

Because of compatibility there is a service alter on CoreServiceProvider::alter that checks for existing functions and this can lead to a different class injection at SocialEmbedHelper

    $uuid_service = $container->getDefinition('uuid');
    // Debian/Ubuntu uses the (broken) OSSP extension as their UUID
    // implementation. The OSSP implementation is not compatible with the
    // PECL functions.
    if (function_exists('uuid_create') && !function_exists('uuid_make')) {
      $uuid_service->setClass('Drupal\Component\Uuid\Pecl');
    }
    // Try to use the COM implementation for Windows users.
    elseif (function_exists('com_create_guid')) {
      $uuid_service->setClass('Drupal\Component\Uuid\Com');
    }

Steps to reproduce

Just enable SocialEmbed

Proposed resolution

Change the expected class from Drupal\Component\Uuid\Php to Drupal\Component\Uuid\UuidInterface

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Comments

tbsiqueira created an issue. See original summary.

tbsiqueira’s picture

tbsiqueira’s picture

Status: Active » Reviewed & tested by the community

  • tbsiqueira committed 815ccd8 on 11.0.x
    Issue #3254114 by tbsiqueira: Wrong UuidInterface instance on...

tbsiqueira’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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