Deprecated (16384): Using key `action` is deprecated, use `url` directly instead. [CORE/Cake/View/Helper/FormHelper.php, line 383

Hello,

The reason why I’m here is one of my clients asked me to fix his CakePhp script. Unfortunately I don’t have any experience of work with this framework, it’s my first time.

Client have a site - where cakephp is istalled in admin/ folder. When I’m trying to open this url … domain.com/admin/users/login - i see login form and error mentioned above. Unfortunately all user accounts provided by client - doesn’t work. When I try to Reset Password - I got another errorDeprecated (16384): Validation::notEmpty() is deprecated. Use Validation::notBlank() instead. [CORE/Cake/Utility/Validation.php, line 60] Warning (2): rand() expects parameter 2 to be integer, float given [APP/Model/User.php, line 156]

according to config file 0.2.9 version is installed on PHP Version 7.2.7-1+0 server.

Any advice will be appreciated
Thank you

I don’t believe there ever was a CakePHP version 0.2.9, and if there was it would never run on PHP 7. That’s maybe the version of some plugin?

It could be cakephp 2.9.0…
If it is so:
In the user model file app/Model/User.php check for validation rules and change notEmpty rule to notBlank.

For ‘action’ deprecated problem find find app/view/Users/login.ctp and find $this->Form->create(…)
and change ‘action’ to array(‘url’=>array(‘controller’=>‘users’,‘action’=>‘whatever action name was in it before’))

If cakephp base version is 3, then the files you need to change are in app/src, but there is a completly different story.
check http://book.cakephp.org for more info (don’t forget to change the book version to your cakephp version, I guess to 2.x). You could find infos about deprecated things also.

@Zuluru

Here what I find in config file

  • copyright Copyright © Cake Software Foundation, Inc. ()
  • link cakephp.org CakePHP™ Project
  • package app.Config
  • since CakePHP™ v 0.2.9

Ok. Sipiatti, I’ll try it now.

2 more questions:

  1. Unfortunately I can’t login, using the Login pass that I have - I got another error -

[ Deprecated (16384)](javascript:void(0);): Validation::notEmpty() is deprecated. Use Validation::notBlank() instead. [ CORE/Cake/Utility/Validation.php , line 60 ]

  1. How can I change password from database?
    used MD5 and other various algorithms with no luck

Your Cakephp version is 2.10.15
I guess your app is using the cakephp auth component, so it uses sha algorithm with a ‘salt’ so insert password through e.g. phpmyadmin is not possible.

Make an action in users controller like this:

public function resetadminpw() {
    $user = $this->User->find('first', array('conditions' => array('User.' . $this->User->primaryKey => 1)));
    $user['User']['password'] = 'abc123';
    $this->User->save($user);
    $this->redirect(array('action'=>'login'));
}

In order to use it you need to allow the resetadminpw action in your app without login. If the Auth component has been set to use controller authentication then you could allow it in the controller’s beforeFilter method:

public function beforeFilter() {
        parent::beforeFilter();
        $this->Auth->allow('login','logout','resetadminpw');
    }

Then you only have to call http://yourappurl/users/resetadminpw and login after it with the username of the ID1 user (from users table) and abc123 as password

Thank Sipiatti, deprecated error is gone on load, but it returns when trying to log in. definitely has something to do with validating the login/password now.

sipiatti

Can you clarify where I need to put this code? In which file ?

You need to put it in the UsersController.php