Loading core/lib/Drupal/Core/Render/Element.php +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ class Element { * TRUE of the key is a property, FALSE otherwise. */ public static function property($key) { return $key[0] == '#'; return is_string($key) && $key[0] == '#'; } /** Loading core/tests/Drupal/Tests/Core/Render/ElementTest.php +3 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ public function testProperty() { $this->assertTrue(Element::property('#property')); $this->assertFalse(Element::property('property')); $this->assertFalse(Element::property('property#')); $this->assertFalse(Element::property(0)); } /** Loading @@ -29,13 +30,12 @@ public function testProperties() { '#property1' => 'property1', '#property2' => 'property2', 'property3' => 'property3', 0 => [], ]; $properties = Element::properties($element); $this->assertContains('#property1', $properties); $this->assertContains('#property2', $properties); $this->assertNotContains('property3', $properties); $this->assertSame(['#property1', '#property2'], $properties); } /** Loading Loading
core/lib/Drupal/Core/Render/Element.php +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ class Element { * TRUE of the key is a property, FALSE otherwise. */ public static function property($key) { return $key[0] == '#'; return is_string($key) && $key[0] == '#'; } /** Loading
core/tests/Drupal/Tests/Core/Render/ElementTest.php +3 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ public function testProperty() { $this->assertTrue(Element::property('#property')); $this->assertFalse(Element::property('property')); $this->assertFalse(Element::property('property#')); $this->assertFalse(Element::property(0)); } /** Loading @@ -29,13 +30,12 @@ public function testProperties() { '#property1' => 'property1', '#property2' => 'property2', 'property3' => 'property3', 0 => [], ]; $properties = Element::properties($element); $this->assertContains('#property1', $properties); $this->assertContains('#property2', $properties); $this->assertNotContains('property3', $properties); $this->assertSame(['#property1', '#property2'], $properties); } /** Loading