Skip to content

Commit

Permalink
Remove default serialization of all view vars.
Browse files Browse the repository at this point in the history
This is an unsafe default and a comment warning is not enough.
  • Loading branch information
ADmad authored and markstory committed Dec 8, 2017
1 parent 039df43 commit 84ec633
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,4 @@ public function initialize()
//$this->loadComponent('Security');
//$this->loadComponent('Csrf');
}

/**
* Before render callback.
*
* @param \Cake\Event\Event $event The beforeRender event.
* @return \Cake\Http\Response|null|void
*/
public function beforeRender(Event $event)
{
// Note: These defaults are just to get started quickly with development
// and should not be used in production.
// You should instead set "_serialize" in each action as required.
if (!array_key_exists('_serialize', $this->viewVars) &&
in_array($this->response->getType(), ['application/json', 'application/xml'])
) {
$this->set('_serialize', true);
}
}
}

0 comments on commit 84ec633

Please sign in to comment.