mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Checking types before calling methods.
This commit is contained in:
parent
cff980b45d
commit
168c6f14c2
2 changed files with 3 additions and 3 deletions
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue