diff --git a/cake/libs/controller/component.php b/cake/libs/controller/component.php index c0d4b57a67f..95ceb00b8e0 100644 --- a/cake/libs/controller/component.php +++ b/cake/libs/controller/component.php @@ -108,7 +108,7 @@ public function __get($name) { * @return void * @link http://book.cakephp.org/view/998/MVC-Class-Access-Within-Components */ - public function initialize(&$controller) { } + public function initialize($controller) { } /** * Called after the Controller::beforeFilter() and before the controller action @@ -117,7 +117,7 @@ public function initialize(&$controller) { } * @return void * @link http://book.cakephp.org/view/998/MVC-Class-Access-Within-Components */ - public function startup(&$controller) { } + public function startup($controller) { } /** * Called after the Controller::beforeRender(), after the view class is loaded, and before the @@ -126,7 +126,7 @@ public function startup(&$controller) { } * @param object $controller Controller with components to beforeRender * @return void */ - public function beforeRender(&$controller) { } + public function beforeRender($controller) { } /** * Called after Controller::render() and before the output is printed to the browser. @@ -134,7 +134,7 @@ public function beforeRender(&$controller) { } * @param object $controller Controller with components to shutdown * @return void */ - function shutdown(&$controller) { } + function shutdown($controller) { } /** * Called before Controller::redirect(). Allows you to replace the url that will @@ -154,6 +154,6 @@ function shutdown(&$controller) { } * @param bool $exit Will the script exit. * @return mixed Either an array or null. */ - public function beforeRedirect(&$controller, $url, $status = null, $exit = true) {} + public function beforeRedirect($controller, $url, $status = null, $exit = true) {} } diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index a075f4fcf43..f8e74f3a14d 100644 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -262,7 +262,7 @@ class AuthComponent extends Component { * @param object $controller A reference to the instantiating controller object * @return void */ - public function initialize(Controller $controller, $settings = array()) { + public function initialize($controller) { $this->request = $controller->request; $this->params = $this->request; @@ -299,7 +299,7 @@ public function initialize(Controller $controller, $settings = array()) { * @param object $controller A reference to the instantiating controller object * @return boolean */ - public function startup(&$controller) { + public function startup($controller) { $isErrorOrTests = ( strtolower($controller->name) == 'cakeerror' || (strtolower($controller->name) == 'tests' && Configure::read('debug') > 0) @@ -926,7 +926,7 @@ public function password($password) { * * @param object $controller Instantiating controller */ - public function shutdown(&$controller) { + public function shutdown($controller) { if ($this->_loggedIn) { $this->Session->delete('Auth.redirect'); } diff --git a/cake/libs/controller/components/cookie.php b/cake/libs/controller/components/cookie.php index cb12ad46e70..f8aac83a017 100644 --- a/cake/libs/controller/components/cookie.php +++ b/cake/libs/controller/components/cookie.php @@ -182,7 +182,7 @@ public function __construct(ComponentCollection $collection, $settings = array() * Start CookieComponent for use in the controller * */ - public function startup() { + public function startup($controller) { $this->_expire($this->time); if (isset($_COOKIE[$this->name])) { diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php index bd8774fd3bd..bcb854be3aa 100755 --- a/cake/libs/controller/components/email.php +++ b/cake/libs/controller/components/email.php @@ -338,7 +338,7 @@ public function __construct(ComponentCollection $collection, $settings = array() * * @param object $controller Instantiating controller */ - public function initialize(&$controller) { + public function initialize($controller) { if (Configure::read('App.encoding') !== null) { $this->charset = Configure::read('App.encoding'); } @@ -349,7 +349,7 @@ public function initialize(&$controller) { * * @param object $controller Instantiating controller */ - public function startup(&$controller) {} + public function startup($controller) {} /** * Send an email using the specified content, template and layout diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index b68e5e33eab..b688c755dbf 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -118,7 +118,7 @@ function __construct(ComponentCollection $collection, $settings = array()) { * @return void * @see Router::parseExtensions() */ - public function initialize(&$controller, $settings = array()) { + public function initialize($controller, $settings = array()) { $this->request = $controller->request; $this->response = $controller->response; if (isset($this->request->params['url']['ext'])) { @@ -156,7 +156,7 @@ public function initialize(&$controller, $settings = array()) { * @param object $controller A reference to the controller * @return void */ - public function startup(&$controller) { + public function startup($controller) { $controller->request->params['isAjax'] = $this->request->is('ajax'); $isRecognized = ( !in_array($this->ext, array('html', 'htm')) && @@ -194,7 +194,7 @@ public function startup(&$controller) { * @param mixed $url A string or array containing the redirect location * @param mixed HTTP Status for redirect */ - public function beforeRedirect(&$controller, $url, $status = null) { + public function beforeRedirect($controller, $url, $status = null, $exit = true) { if (!$this->request->is('ajax')) { return; } @@ -509,7 +509,7 @@ public function prefers($type = null) { * @see RequestHandlerComponent::setContent() * @see RequestHandlerComponent::respondAs() */ - public function renderAs(&$controller, $type, $options = array()) { + public function renderAs($controller, $type, $options = array()) { $defaults = array('charset' => 'UTF-8'); if (Configure::read('App.encoding') !== null) { diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php index 69e13dbbd12..b3ae711d851 100644 --- a/cake/libs/controller/components/security.php +++ b/cake/libs/controller/components/security.php @@ -211,7 +211,7 @@ class SecurityComponent extends Component { * @param object $controller Instantiating controller * @return void */ - public function startup(&$controller) { + public function startup($controller) { $this->request = $controller->request; $this->_action = strtolower($this->request->params['action']); $this->_methodsRequired($controller); @@ -441,7 +441,7 @@ function generateDigestResponseHash($data) { * @see SecurityComponent::$blackHoleCallback * @link http://book.cakephp.org/view/1307/blackHole-object-controller-string-error */ - function blackHole(&$controller, $error = '') { + function blackHole($controller, $error = '') { if ($this->blackHoleCallback == null) { $code = 404; if ($error == 'login') { @@ -474,7 +474,7 @@ protected function _requireMethod($method, $actions = array()) { * @param object $controller Instantiating controller * @return bool true if $method is required */ - protected function _methodsRequired(&$controller) { + protected function _methodsRequired($controller) { foreach (array('Post', 'Get', 'Put', 'Delete') as $method) { $property = 'require' . $method; if (is_array($this->$property) && !empty($this->$property)) { @@ -497,7 +497,7 @@ protected function _methodsRequired(&$controller) { * @param object $controller Instantiating controller * @return bool true if secure connection required */ - protected function _secureRequired(&$controller) { + protected function _secureRequired($controller) { if (is_array($this->requireSecure) && !empty($this->requireSecure)) { $requireSecure = array_map('strtolower', $this->requireSecure); @@ -518,7 +518,7 @@ protected function _secureRequired(&$controller) { * @param object $controller Instantiating controller * @return bool true if authentication required */ - protected function _authRequired(&$controller) { + protected function _authRequired($controller) { if (is_array($this->requireAuth) && !empty($this->requireAuth) && !empty($this->request->data)) { $requireAuth = array_map('strtolower', $this->requireAuth); @@ -553,7 +553,7 @@ protected function _authRequired(&$controller) { * @param object $controller Instantiating controller * @return bool true if login is required */ - protected function _loginRequired(&$controller) { + protected function _loginRequired($controller) { if (is_array($this->requireLogin) && !empty($this->requireLogin)) { $requireLogin = array_map('strtolower', $this->requireLogin); @@ -600,7 +600,7 @@ protected function _loginRequired(&$controller) { * @param object $controller Instantiating controller * @return bool true if submitted form is valid */ - protected function _validatePost(&$controller) { + protected function _validatePost($controller) { if (empty($controller->request->data)) { return true; } @@ -672,7 +672,7 @@ protected function _validatePost(&$controller) { * @param object $controller Instantiating controller * @return bool Success */ - protected function _generateToken(&$controller) { + protected function _generateToken($controller) { if (isset($controller->request->params['requested']) && $controller->request->params['requested'] === 1) { if ($this->Session->check('_Token')) { $tokenData = $this->Session->read('_Token'); @@ -765,7 +765,7 @@ protected function _setLoginDefaults(&$options) { * @param array $params Parameters to send to method * @return mixed Controller callback method's response */ - protected function _callback(&$controller, $method, $params = array()) { + protected function _callback($controller, $method, $params = array()) { if (is_callable(array($controller, $method))) { return call_user_func_array(array(&$controller, $method), empty($params) ? null : $params); } else { diff --git a/cake/libs/router.php b/cake/libs/router.php index a4408b92f3b..6113018674a 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -1217,7 +1217,8 @@ public static function getArgs($args, $options = array()) { } else { if (preg_match_all('/\[([A-Za-z0-9_-]+)?\]/', $key, $matches, PREG_SET_ORDER)) { $matches = array_reverse($matches); - $key = array_shift(explode('[', $key)); + $parts = explode('[', $key); + $key = array_shift($parts); $arr = $val; foreach ($matches as $match) { if (empty($match[1])) { diff --git a/cake/tests/cases/libs/controller/component.test.php b/cake/tests/cases/libs/controller/component.test.php index 726f3b3acc4..3c8dc99c688 100644 --- a/cake/tests/cases/libs/controller/component.test.php +++ b/cake/tests/cases/libs/controller/component.test.php @@ -52,7 +52,7 @@ class ParamTestComponent extends Component { * @access public * @return void */ - function initialize(&$controller, $settings) { + function initialize($controllerz) { foreach ($settings as $key => $value) { if (is_numeric($key)) { $this->{$value} = true; @@ -120,7 +120,7 @@ class AppleComponent extends Component { * @access public * @return void */ - function startup(&$controller) { + function startup($controller) { $this->testName = $controller->name; } } @@ -148,7 +148,7 @@ class OrangeComponent extends Component { * @access public * @return void */ - function initialize(&$controller) { + function initialize($controller) { $this->Controller = $controller; $this->Banana->testField = 'OrangeField'; } @@ -159,7 +159,7 @@ function initialize(&$controller) { * @param Controller $controller * @return string */ - public function startup(&$controller) { + public function startup($controller) { $controller->foo = 'pass'; } } @@ -186,7 +186,7 @@ class BananaComponent extends Component { * @param Controller $controller * @return string */ - public function startup(&$controller) { + public function startup($controller) { $controller->bar = 'fail'; } } diff --git a/cake/tests/cases/libs/controller/components/auth.test.php b/cake/tests/cases/libs/controller/components/auth.test.php index 98f389efd72..5b6f7262e19 100644 --- a/cake/tests/cases/libs/controller/components/auth.test.php +++ b/cake/tests/cases/libs/controller/components/auth.test.php @@ -52,7 +52,7 @@ class TestAuthComponent extends AuthComponent { * @access public * @return void */ - function _stop() { + function _stop($status = 0) { $this->testStop = true; } } @@ -498,7 +498,8 @@ function setUp() { ); $this->Controller->beforeFilter(); - ClassRegistry::addObject('view', new View($this->Controller)); + $view = new View($this->Controller); + ClassRegistry::addObject('view', $view); $this->Controller->Session->delete('Auth'); $this->Controller->Session->delete('Message.auth'); diff --git a/cake/tests/cases/libs/controller/components/cookie.test.php b/cake/tests/cases/libs/controller/components/cookie.test.php index 84a852c6d23..7d441e4c2bd 100644 --- a/cake/tests/cases/libs/controller/components/cookie.test.php +++ b/cake/tests/cases/libs/controller/components/cookie.test.php @@ -383,7 +383,7 @@ function testReadingCookieDataOnStartup() { 'name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!')); - $this->Cookie->startup(); + $this->Cookie->startup(null); $data = $this->Cookie->read('Encrytped_array'); $expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!'); diff --git a/cake/tests/cases/libs/controller/components/email.test.php b/cake/tests/cases/libs/controller/components/email.test.php index ea2d86b2911..9ce4602e12b 100755 --- a/cake/tests/cases/libs/controller/components/email.test.php +++ b/cake/tests/cases/libs/controller/components/email.test.php @@ -230,7 +230,8 @@ function setUp() { $this->Controller->Components->init($this->Controller); $this->Controller->EmailTest->initialize($this->Controller, array()); - ClassRegistry::addObject('view', new View($this->Controller)); + $view = new View($this->Controller); + ClassRegistry::addObject('view', $view); App::build(array( 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS) diff --git a/cake/tests/cases/libs/controller/components/paginator.test.php b/cake/tests/cases/libs/controller/components/paginator.test.php index cb6beb153fa..20abfd8da45 100644 --- a/cake/tests/cases/libs/controller/components/paginator.test.php +++ b/cake/tests/cases/libs/controller/components/paginator.test.php @@ -113,13 +113,13 @@ function beforeFind($query) { * @access public * @return void */ - function find($type, $options = array()) { - if ($type == 'popular') { + function find($conditions = null, $fields = array(), $order = null, $recursive = null) { + if ($conditions == 'popular') { $conditions = array($this->name . '.' . $this->primaryKey .' > ' => '1'); - $options = Set::merge($options, compact('conditions')); + $options = Set::merge($fields, compact('conditions')); return parent::find('all', $options); } - return parent::find($type, $options); + return parent::find($conditions, $fields); } } diff --git a/cake/tests/cases/libs/controller/components/security.test.php b/cake/tests/cases/libs/controller/components/security.test.php index bd0bcc9f112..33548c70e9b 100644 --- a/cake/tests/cases/libs/controller/components/security.test.php +++ b/cake/tests/cases/libs/controller/components/security.test.php @@ -34,7 +34,7 @@ class TestSecurityComponent extends SecurityComponent { * @param Controller $controller * @return unknown */ - function validatePost(&$controller) { + function validatePost($controller) { return $this->_validatePost($controller); } } @@ -98,8 +98,8 @@ function fail() { * @access public * @return void */ - function redirect($option, $code, $exit) { - return $code; + function redirect($url, $status = null, $exit = true) { + return $status; } /** diff --git a/cake/tests/cases/libs/controller/controller.test.php b/cake/tests/cases/libs/controller/controller.test.php index 851e3a4a41d..39563931b65 100644 --- a/cake/tests/cases/libs/controller/controller.test.php +++ b/cake/tests/cases/libs/controller/controller.test.php @@ -113,13 +113,13 @@ function beforeFind($query) { * @access public * @return void */ - function find($type, $options = array()) { - if ($type == 'popular') { + function find($conditions = null, $fields = array(), $order = null, $recursive = null) { + if ($conditions == 'popular') { $conditions = array($this->name . '.' . $this->primaryKey .' > ' => '1'); - $options = Set::merge($options, compact('conditions')); - return parent::find('all', $options); + $options = Set::merge($fields, compact('conditions')); + return parent::find('all', $fields); } - return parent::find($type, $options); + return parent::find($conditions, $fields); } } @@ -326,7 +326,7 @@ function beforeRedirect() { * @access public * @return void */ - function initialize(&$controller) { + function initialize($controller) { } /** @@ -335,7 +335,7 @@ function initialize(&$controller) { * @access public * @return void */ - function startup(&$controller) { + function startup($controller) { } /** * shutdown method @@ -343,14 +343,14 @@ function startup(&$controller) { * @access public * @return void */ - function shutdown(&$controller) { + function shutdown($controller) { } /** * beforeRender callback * * @return void */ - function beforeRender(&$controller) { + function beforeRender($controller) { if ($this->viewclass) { $controller->view = $this->viewclass; } diff --git a/cake/tests/cases/libs/controller/pages_controller.test.php b/cake/tests/cases/libs/controller/pages_controller.test.php index f22a6eba644..3d308471956 100644 --- a/cake/tests/cases/libs/controller/pages_controller.test.php +++ b/cake/tests/cases/libs/controller/pages_controller.test.php @@ -27,16 +27,6 @@ */ class PagesControllerTest extends CakeTestCase { -/** - * endTest method - * - * @access public - * @return void - */ - function endTest() { - App::build(); - } - /** * testDisplay method * diff --git a/cake/tests/cases/libs/controller/scaffold.test.php b/cake/tests/cases/libs/controller/scaffold.test.php index e0f925b3983..a68e7ad2bd3 100644 --- a/cake/tests/cases/libs/controller/scaffold.test.php +++ b/cake/tests/cases/libs/controller/scaffold.test.php @@ -93,8 +93,8 @@ class TestScaffoldMock extends Scaffold { * * @param unknown_type $params */ - function _scaffold($params) { - $this->_params = $params; + function _scaffold(CakeRequest $request) { + $this->_params = $request; } /** diff --git a/cake/tests/cases/libs/error/exception_renderer.test.php b/cake/tests/cases/libs/error/exception_renderer.test.php index 91efdf6081e..4de432fb980 100644 --- a/cake/tests/cases/libs/error/exception_renderer.test.php +++ b/cake/tests/cases/libs/error/exception_renderer.test.php @@ -67,7 +67,7 @@ class BlueberryComponent extends Component { * @access public * @return void */ - function initialize(&$controller) { + function initialize($controller) { $this->testName = 'BlueberryComponent'; } }