Commit 3b0cb393 authored by mxh's avatar mxh
Browse files

Issue #3277439 by jurgenhaas, mxh, joelseguin: Recursion detection may throw false positives

parent 374718d8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ class SetFieldValue extends FieldUpdateActionBase implements EcaFieldUpdateActio
    $form['field_name'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Field name'),
      '#description' => $this->t('The machine name of the field, that should be changed. This property supports tokens.'),
      '#description' => $this->t('The machine name of the field, that should be changed. This property supports tokens. Example: <em>body.value</em>'),
      '#default_value' => $this->configuration['field_name'],
      '#weight' => -10,
    ];
+1 −1
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ class ContentEntityEvent extends EventBase {
        'tags' => Tag::CONTENT | Tag::WRITE | Tag::RUNTIME | Tag::AFTER,
      ],
      'custom' => [
        'label' => 'ECA content entity custom event',
        'label' => 'ECA custom event (entity-aware)',
        'event_name' => ContentEntityEvents::CUSTOM,
        'event_class' => ContentEntityCustomEvent::class,
        'tags' => Tag::CONTENT | Tag::WRITE | Tag::RUNTIME | Tag::AFTER,
+8 −4
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ class Processor {
        $this->logger->debug('Check %eventlabel (%eventid) from ECA %ecalabel (%ecaid) for event %event.', $context);
        if ($ecaEvent->applies($event, $event_name)) {
          // We need to check whether this is the root of all execution calls,
          // for being able to purge the execution history once it is not
          // for being able to purge the whole execution history once it is not
          // needed anymore.
          $is_root_execution = empty($this->executionHistory);
          // Take a look for a repetitive execution order. If we find one,
@@ -127,9 +127,9 @@ class Processor {
            continue;
          }

          // Temporarily keep in mind what execution was applied here. If that
          // behavior starts to repeat, we'll halt the execution pipeline to
          // prevent infinite recursion.
          // Temporarily keep in mind on which ECA event object execution is
          // about to be applied. If that behavior starts to repeat, then halt
          // the execution pipeline to prevent infinite recursion.
          $this->executionHistory[] = $ecaEvent;

          $before_event = new BeforeInitialExecutionEvent($eca, $ecaEvent, $event);
@@ -138,6 +138,10 @@ class Processor {
          // Now that we have any required context, we may execute the logic.
          $this->logger->info('Start %eventlabel (%eventid) from ECA %ecalabel (%ecaid) for event %event.', $context);
          $this->executeSuccessors($eca, $ecaEvent, $event, $context);
          // At this point, no nested triggering of events happened or was
          // prevented by something else. Therefore remove the last added
          // item from the history stack as it's not needed anymore.
          array_pop($this->executionHistory);

          $this->eventDispatcher->dispatch(new AfterInitialExecutionEvent($eca, $ecaEvent, $event, $before_event->getPrestate(NULL)), EcaEvents::AFTER_INITIAL_EXECUTION);