I’m new to cakephp and following this tutorial for a user authentication system
http://bakery.cakephp.org/articles/SeanCallan/2007/04/17/simple-form-authentication-in-1-2-x-x
The only thing I changed is in the file login.ctp. I changed the pointers from
$form->
to
$this->Form->
I’m getting two errors and I can’t figure out why. Here is the first
Warning (2): Illegal offset type [CORE\Cake\Model\Model.php, line 2603]
This is the code/context it displays
if ($type !== ‘all’) {
if ($this->findMethods[$type] === true) {
$type = array(
'username' => '',
'password' => '*****'
)
$query = array(
'conditions' => null,
'fields' => null,
'joins' => array(),
'limit' => null,
'offset' => null,
'order' => null,
'page' => (int) 1,
'group' => null,
'callbacks' => true,
(int) 0 => 'id',
(int) 1 => 'username'
)
$this = object(User) {}
This information was also displayed
Model::buildQuery() - CORE\Cake\Model\Model.php, line 2603
Model::find() - CORE\Cake\Model\Model.php, line 2562
User::validateLogin() - APP\Model\User.php, line 9
UsersController::login() - APP\Controller\UsersController.php, line 21
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE\Cake\Controller\Controller.php, line 484
Dispatcher::_invoke() - CORE\Cake\Routing\Dispatcher.php, line 104
Dispatcher::dispatch() - CORE\Cake\Routing\Dispatcher.php, line 86
[main] - APP\webroot\index.php, line 96
Here is the second error
Warning (2): Illegal offset type [CORE\Cake\Model\Model.php, line 2579]
This is the code it displays
return $results;
} else {
if ($this->findMethods[$type] === true) {
$type = array(
'username' => '',
'password' => '*****'
)
$query = array(
'conditions' => null,
'fields' => null,
'joins' => array(),
'limit' => null,
'offset' => null,
'order' => array(
),
'page' => (int) 1,
'group' => null,
'callbacks' => true,
(int) 0 => 'id',
(int) 1 => 'username'
)
$results = array(
(int) 0 => array(
)
)
$this = object(User) {}
Here is the additional information
Model::find() - CORE\Cake\Model\Model.php, line 2579
User::validateLogin() - APP\Model\User.php, line 9
UsersController::login() - APP\Controller\UsersController.php, line 21
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE\Cake\Controller\Controller.php, line 484
Dispatcher::_invoke() - CORE\Cake\Routing\Dispatcher.php, line 104
Dispatcher::dispatch() - CORE\Cake\Routing\Dispatcher.php, line 86
[main] - APP\webroot\index.php, line 96
I would suggest you follow the more recent tutorial at
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
Which should follow your setup exactly since you are using cakephp 2.1. The one you are trying to follow now is for cakephp1.2 and was written on 2007 so I doubt it’s going to be useful for you.