-
Notifications
You must be signed in to change notification settings - Fork 111
Require $this->headers to be instance of Headers #124
Conversation
There may be other areas where it would be beneficial to convert fatal errors to catchable exceptions besides the instance I found here. |
Wouldn't bother too much about it, given the upcoming drop of PHP 5.x support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests for the introduced fixes are missing
@@ -294,10 +294,16 @@ public function getHeaders() | |||
*/ | |||
public function getHeader($name, $format = null) | |||
{ | |||
$header = $this->getHeaders()->get($name); | |||
$headers = $this->getHeaders(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API of getHeaders
specifies that a Headers
instance MUST be returned. If that is not true, then getHeaders
needs fixing, and you are fixing a symptom here.
@@ -383,7 +389,13 @@ public function __get($name) | |||
*/ | |||
public function __isset($name) | |||
{ | |||
return $this->getHeaders()->has($name); | |||
$headers = $this->getHeaders(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API of getHeaders
specifies that a Headers
instance MUST be returned. If that is not true, then getHeaders
needs fixing, and you are fixing a symptom here.
Right, I'll send a superseding PR. |
Replaces zendframework#124
Turns a fatal error into a catchable Exception (which allows users to have a helpful stack trace).
This sort of change will be unnecessary in PHP 7 (hooray return type declarations and catchable
TypeError
s).