Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Fixing issue #100 withHeader does not remove old header value #101

Merged
merged 3 commits into from
Dec 15, 2015
Merged

Conversation

pdscopes
Copy link
Contributor

Pull request to fix Issue #100

@Maks3w
Copy link
Member

Maks3w commented Oct 26, 2015

Need a test case

@@ -204,6 +204,9 @@ public function withHeader($header, $value)
$normalized = strtolower($header);

$new = clone $this;
if($new->hasHeader($header)) {
unset($new->headers[$new->headerNames[$normalized]]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this could be done always and remove the if

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem there is, if $new->headerNames[$normalized]doesn't exist PHP will throw a warning.
I guess we could not use $new->hasHeader() and directly call array_key_exists($normilized, $new->headerNames).
What do you think?

@weierophinney weierophinney added this to the 1.2.1 milestone Dec 15, 2015
@weierophinney weierophinney self-assigned this Dec 15, 2015
@weierophinney weierophinney merged commit fca9eee into zendframework:master Dec 15, 2015
weierophinney added a commit that referenced this pull request Dec 15, 2015
Fixing issue #100 withHeader does not remove old header value
weierophinney added a commit that referenced this pull request Dec 15, 2015
weierophinney added a commit that referenced this pull request Dec 15, 2015
weierophinney added a commit that referenced this pull request Dec 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants