Verified Commit e91e6e48 authored by Dave Long's avatar Dave Long
Browse files

fix: #3524163 [regression] Empty slot definitions give incorrect validation message

By: longwave
By: prudloff
By: pemson18
By: amanire
By: paulmckibben
By: smustgrave
(cherry picked from commit 0ea7fb77)
parent e586ddcd
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -82,6 +82,14 @@ public function validateDefinition(array $definition, bool $enforce_schemas): bo
      $schema['properties'] = new \stdClass();
    }

    // If a slot has an empty definition,
    // force casting to object instead of array.
    foreach ($definition['slots'] ?? [] as $slot_name => $slot) {
      if ($slot === []) {
        $definition['slots'][$slot_name] = new \stdClass();
      }
    }

    // Ensure that all property types are strings. For example, a null value
    // will not automatically convert to 'null', which will lead to a PHP error
    // that is hard to trace back to the property.
+1 −0
Original line number Diff line number Diff line
@@ -43,3 +43,4 @@ slots:
    description: The contents of the banner.
    examples:
      - <p>Foo is <strong>NOT</strong> bar.</p>
  minimal: { }