diff --git a/cake/tests/cases/libs/controller/components/paginator.test.php b/cake/tests/cases/libs/controller/components/paginator.test.php index cb6beb153..20abfd8da 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 @@ class PaginatorControllerPost extends CakeTestModel { * @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/lib/Cake/Controller/Component.php b/lib/Cake/Controller/Component.php index 8ce908cda..a6b7e17af 100644 --- a/lib/Cake/Controller/Component.php +++ b/lib/Cake/Controller/Component.php @@ -108,7 +108,7 @@ class Component extends Object { * @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 @@ class Component extends Object { * @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 @@ class Component extends Object { * @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 @@ class Component extends Object { * @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 @@ class Component extends Object { * @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/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index f96e6dbe9..f86c7f03f 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -263,7 +263,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 @@ class AuthComponent extends Component { * @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 @@ class AuthComponent extends Component { * * @param object $controller Instantiating controller */ - public function shutdown(&$controller) { + public function shutdown($controller) { if ($this->_loggedIn) { $this->Session->delete('Auth.redirect'); } diff --git a/lib/Cake/Controller/Component/CookieComponent.php b/lib/Cake/Controller/Component/CookieComponent.php index df0be063d..4569b5191 100644 --- a/lib/Cake/Controller/Component/CookieComponent.php +++ b/lib/Cake/Controller/Component/CookieComponent.php @@ -182,7 +182,7 @@ class CookieComponent extends Component { * 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/lib/Cake/Controller/Component/EmailComponent.php b/lib/Cake/Controller/Component/EmailComponent.php index 9be370fc2..ff45ab934 100755 --- a/lib/Cake/Controller/Component/EmailComponent.php +++ b/lib/Cake/Controller/Component/EmailComponent.php @@ -338,7 +338,7 @@ class EmailComponent extends Component { * * @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 @@ class EmailComponent extends Component { * * @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/lib/Cake/Controller/Component/RequestHandlerComponent.php b/lib/Cake/Controller/Component/RequestHandlerComponent.php index 06f4db96b..66163ab15 100644 --- a/lib/Cake/Controller/Component/RequestHandlerComponent.php +++ b/lib/Cake/Controller/Component/RequestHandlerComponent.php @@ -120,7 +120,7 @@ class RequestHandlerComponent extends Component { * @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'])) { @@ -158,7 +158,7 @@ class RequestHandlerComponent extends Component { * @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')) && @@ -193,7 +193,7 @@ class RequestHandlerComponent extends Component { * @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; } @@ -508,7 +508,7 @@ class RequestHandlerComponent extends Component { * @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/lib/Cake/Controller/Component/SecurityComponent.php b/lib/Cake/Controller/Component/SecurityComponent.php index e9d0de4a5..3e3e299df 100644 --- a/lib/Cake/Controller/Component/SecurityComponent.php +++ b/lib/Cake/Controller/Component/SecurityComponent.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 @@ class SecurityComponent extends Component { * @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 @@ class SecurityComponent extends Component { * @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 @@ class SecurityComponent extends Component { * @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 @@ class SecurityComponent extends Component { * @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 @@ class SecurityComponent extends Component { * @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 @@ class SecurityComponent extends Component { * @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 @@ class SecurityComponent extends Component { * @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 @@ class SecurityComponent extends Component { * @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/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php index 6d12dde18..ee3900f3c 100644 --- a/lib/Cake/Routing/Router.php +++ b/lib/Cake/Routing/Router.php @@ -1217,7 +1217,8 @@ class Router { } 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/lib/Cake/tests/cases/libs/controller/component.test.php b/lib/Cake/tests/cases/libs/controller/component.test.php index abd274ac2..43dff8cd6 100644 --- a/lib/Cake/tests/cases/libs/controller/component.test.php +++ b/lib/Cake/tests/cases/libs/controller/component.test.php @@ -53,7 +53,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; @@ -121,7 +121,7 @@ class AppleComponent extends Component { * @access public * @return void */ - function startup(&$controller) { + function startup($controller) { $this->testName = $controller->name; } } @@ -149,7 +149,7 @@ class OrangeComponent extends Component { * @access public * @return void */ - function initialize(&$controller) { + function initialize($controller) { $this->Controller = $controller; $this->Banana->testField = 'OrangeField'; } @@ -160,7 +160,7 @@ class OrangeComponent extends Component { * @param Controller $controller * @return string */ - public function startup(&$controller) { + public function startup($controller) { $controller->foo = 'pass'; } } @@ -187,7 +187,7 @@ class BananaComponent extends Component { * @param Controller $controller * @return string */ - public function startup(&$controller) { + public function startup($controller) { $controller->bar = 'fail'; } } diff --git a/lib/Cake/tests/cases/libs/controller/components/auth.test.php b/lib/Cake/tests/cases/libs/controller/components/auth.test.php index bc7e01ab4..35f0356bc 100644 --- a/lib/Cake/tests/cases/libs/controller/components/auth.test.php +++ b/lib/Cake/tests/cases/libs/controller/components/auth.test.php @@ -53,7 +53,7 @@ class TestAuthComponent extends AuthComponent { * @access public * @return void */ - function _stop() { + function _stop($status = 0) { $this->testStop = true; } } @@ -499,7 +499,8 @@ class AuthTest extends CakeTestCase { ); $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/lib/Cake/tests/cases/libs/controller/components/cookie.test.php b/lib/Cake/tests/cases/libs/controller/components/cookie.test.php index 7198b84a4..36b0f3bb3 100644 --- a/lib/Cake/tests/cases/libs/controller/components/cookie.test.php +++ b/lib/Cake/tests/cases/libs/controller/components/cookie.test.php @@ -386,7 +386,7 @@ class CookieComponentTest extends CakeTestCase { '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/lib/Cake/tests/cases/libs/controller/components/email.test.php b/lib/Cake/tests/cases/libs/controller/components/email.test.php index 950329921..2863308b0 100755 --- a/lib/Cake/tests/cases/libs/controller/components/email.test.php +++ b/lib/Cake/tests/cases/libs/controller/components/email.test.php @@ -230,7 +230,8 @@ class EmailComponentTest extends CakeTestCase { $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/lib/Cake/tests/cases/libs/controller/components/security.test.php b/lib/Cake/tests/cases/libs/controller/components/security.test.php index f89660fba..d5947f1cc 100644 --- a/lib/Cake/tests/cases/libs/controller/components/security.test.php +++ b/lib/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 @@ class SecurityTestController extends Controller { * @access public * @return void */ - function redirect($option, $code, $exit) { - return $code; + function redirect($url, $status = null, $exit = true) { + return $status; } /** diff --git a/lib/Cake/tests/cases/libs/controller/controller.test.php b/lib/Cake/tests/cases/libs/controller/controller.test.php index 380680b04..fd36df0fa 100644 --- a/lib/Cake/tests/cases/libs/controller/controller.test.php +++ b/lib/Cake/tests/cases/libs/controller/controller.test.php @@ -107,13 +107,13 @@ class ControllerPost extends CakeTestModel { * @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); } } @@ -320,7 +320,7 @@ class TestComponent extends Object { * @access public * @return void */ - function initialize(&$controller) { + function initialize($controller) { } /** @@ -329,7 +329,7 @@ class TestComponent extends Object { * @access public * @return void */ - function startup(&$controller) { + function startup($controller) { } /** * shutdown method @@ -337,14 +337,14 @@ class TestComponent extends Object { * @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/lib/Cake/tests/cases/libs/controller/pages_controller.test.php b/lib/Cake/tests/cases/libs/controller/pages_controller.test.php index de96efa40..ce3d7a0ec 100644 --- a/lib/Cake/tests/cases/libs/controller/pages_controller.test.php +++ b/lib/Cake/tests/cases/libs/controller/pages_controller.test.php @@ -28,16 +28,6 @@ App::uses('PagesController', 'Controller'); */ class PagesControllerTest extends CakeTestCase { -/** - * endTest method - * - * @access public - * @return void - */ - function endTest() { - App::build(); - } - /** * testDisplay method * diff --git a/lib/Cake/tests/cases/libs/controller/scaffold.test.php b/lib/Cake/tests/cases/libs/controller/scaffold.test.php index 140bc2519..147380c7f 100644 --- a/lib/Cake/tests/cases/libs/controller/scaffold.test.php +++ b/lib/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/lib/Cake/tests/cases/libs/error/exception_renderer.test.php b/lib/Cake/tests/cases/libs/error/exception_renderer.test.php index ffdf6d80e..aaf04e4e7 100644 --- a/lib/Cake/tests/cases/libs/error/exception_renderer.test.php +++ b/lib/Cake/tests/cases/libs/error/exception_renderer.test.php @@ -69,7 +69,7 @@ class BlueberryComponent extends Component { * @access public * @return void */ - function initialize(&$controller) { + function initialize($controller) { $this->testName = 'BlueberryComponent'; } }