Skip to content
Snippets Groups Projects
Unverified Commit e71fcde4 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3172166 by Pooja Ganjage, ekes, Megha_kundar, xjm, alexpott,...

Issue #3172166 by Pooja Ganjage, ekes, Megha_kundar, xjm, alexpott, tstoeckler, mbovan, Spokje: Element::properties() produces notices if given an array with integer keys

(cherry picked from commit e14d16c5)
parent 66fd8608
No related branches found
No related tags found
No related merge requests found
......@@ -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] == '#';
}
/**
......
......@@ -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));
}
/**
......@@ -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);
}
/**
......
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