Permalink
Browse files

Checking types before calling methods.

  • Loading branch information...
1 parent cff980b commit 168c6f14c23428aceb6f13e34509c3a188496324 @markstory markstory committed Nov 29, 2011
Showing with 3 additions and 3 deletions.
  1. +2 −2 lib/Cake/View/JsonView.php
  2. +1 −1 lib/Cake/View/XmlView.php
@@ -63,8 +63,8 @@ class JsonView extends View {
*/
public function __construct($controller) {
parent::__construct($controller);
- if (is_object($controller)) {
- $this->response->type('json');
+ if (isset($controller->response) && $controller->response instanceof CakeResponse) {
+ $controller->response->type('json');
}
}
@@ -66,7 +66,7 @@ class XmlView extends View {
public function __construct($controller) {
parent::__construct($controller);
- if (is_object($controller)) {
+ if (isset($controller->response) && $controller->response instanceof CakeResponse) {
$controller->response->type('xml');
}
}

0 comments on commit 168c6f1

Please sign in to comment.