Skip to content

Commit

Permalink
Merge pull request #155 from laminas/2.14.x-merge-up-into-2.15.x_60a5…
Browse files Browse the repository at this point in the history
…df72ce9466.67078403

Merge release 2.14.1 into 2.15.x
  • Loading branch information
Xerkus authored May 20, 2021
2 parents 9a88d00 + 180c6c7 commit 799f7c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public function get($name)
$key = $this->normalizeFieldName($name);
$results = [];

foreach (array_keys($this->headersKeys, $key) as $index) {
foreach (array_keys($this->headersKeys, $key, true) as $index) {
if ($this->headers[$index] instanceof Header\GenericHeader) {
$results[] = $this->lazyLoadHeader($index);
} else {
Expand Down Expand Up @@ -403,7 +403,7 @@ public function get($name)
public function has($name)
{
$name = $this->normalizeFieldName($name);
return in_array($name, $this->headersKeys);
return in_array($name, $this->headersKeys, true);
}

/**
Expand Down
12 changes: 12 additions & 0 deletions test/HeadersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,4 +634,16 @@ public function testCanInjectAlternateHeaderLocatorInstance(): void
$headers->setHeaderLocator($locator);
$this->assertSame($locator, $headers->getHeaderLocator());
}

public function testStrictKeyComparisonInHas(): void
{
$headers = Mail\Headers::fromString("000: foo-bar");
$this->assertFalse($headers->has('0'));
}

public function testStrictKeyComparisonInGet(): void
{
$headers = Mail\Headers::fromString("000: foo-bar");
$this->assertFalse($headers->get('0'));
}
}

0 comments on commit 799f7c4

Please sign in to comment.