Skip to content
Snippets Groups Projects
Verified Commit c0053e63 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3293926 by kingdutch, geekygnr, godotislate, m4olivei, longwave: Error...

Issue #3293926 by kingdutch, geekygnr, godotislate, m4olivei, longwave: Error decorating non-existent service when inner service's module not installed
parent f0b4dd2b
No related branches found
No related tags found
12 merge requests!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #318857 passed with warnings
Pipeline: drupal

#318869

    Pipeline: drupal

    #318865

      Pipeline: drupal

      #318859

        ...@@ -390,10 +390,32 @@ private function parseDefinition(string $id, $service, string $file, array $defa ...@@ -390,10 +390,32 @@ private function parseDefinition(string $id, $service, string $file, array $defa
        $definition->addTag($name, $tag); $definition->addTag($name, $tag);
        } }
        if (isset($service['decorates'])) { if (null !== $decorates = $service['decorates'] ?? null) {
        if ('' !== $decorates && '@' === $decorates[0]) {
        throw new InvalidArgumentException(\sprintf('The value of the "decorates" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").', $id, $service['decorates'], substr($decorates, 1)));
        }
        $decorationOnInvalid = \array_key_exists('decoration_on_invalid', $service) ? $service['decoration_on_invalid'] : 'exception';
        if ('exception' === $decorationOnInvalid) {
        $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
        }
        elseif ('ignore' === $decorationOnInvalid) {
        $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
        }
        elseif (null === $decorationOnInvalid) {
        $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
        }
        elseif ('null' === $decorationOnInvalid) {
        throw new InvalidArgumentException(\sprintf('Invalid value "%s" for attribute "decoration_on_invalid" on service "%s". Did you mean null (without quotes) in "%s"?', $decorationOnInvalid, $id, $file));
        }
        else {
        throw new InvalidArgumentException(\sprintf('Invalid value "%s" for attribute "decoration_on_invalid" on service "%s". Did you mean "exception", "ignore" or null in "%s"?', $decorationOnInvalid, $id, $file));
        }
        $renameId = $service['decoration_inner_name'] ?? null; $renameId = $service['decoration_inner_name'] ?? null;
        $priority = $service['decoration_priority'] ?? 0; $priority = $service['decoration_priority'] ?? 0;
        $definition->setDecoratedService($service['decorates'], $renameId, $priority);
        $definition->setDecoratedService($decorates, $renameId, $priority, $invalidBehavior);
        } }
        if (isset($service['autowire'])) { if (isset($service['autowire'])) {
        ......
        ...@@ -200,6 +200,38 @@ public static function providerTestExceptions() { ...@@ -200,6 +200,38 @@ public static function providerTestExceptions() {
        YAML, YAML,
        'The service file "vfs://drupal/modules/example/example.yml" is not valid: it contains invalid root key(s) "do not". Services have to be added under "services" and Parameters under "parameters".', 'The service file "vfs://drupal/modules/example/example.yml" is not valid: it contains invalid root key(s) "do not". Services have to be added under "services" and Parameters under "parameters".',
        ], ],
        'decorates must be without @' => [<<<YAML
        services:
        example_service_1:
        class: \Drupal\Core\ExampleClass
        example_decoration:
        class: \Drupal\Core\ExampleClass
        decorates: "@example_service_1"
        YAML,
        'The value of the "decorates" option for the "example_decoration" service must be the id of the service without the "@" prefix (replace "@example_service_1" with "example_service_1").',
        ],
        'decorates_on_invalid may not be "null" with quotes' => [<<<YAML
        services:
        example_service_1:
        class: \Drupal\Core\ExampleClass
        example_decoration:
        class: \Drupal\Core\ExampleClass
        decorates: example_service_1
        decoration_on_invalid: "null"
        YAML,
        'Invalid value "null" for attribute "decoration_on_invalid" on service "example_decoration". Did you mean null (without quotes) in "vfs://drupal/modules/example/example.yml"?',
        ],
        'decoration_on_invalid must be valid' => [<<<YAML
        services:
        example_service_1:
        class: \Drupal\Core\ExampleClass
        example_decoration:
        class: \Drupal\Core\ExampleClass
        decorates: example_service_1
        decoration_on_invalid: foo
        YAML,
        'Invalid value "foo" for attribute "decoration_on_invalid" on service "example_decoration". Did you mean "exception", "ignore" or null in "vfs://drupal/modules/example/example.yml"?',
        ],
        ]; ];
        } }
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment