# Problem with sessions Support for loading components using $components property is removed. Use $this-\>loadComponent() instead in initialize()

**URL:** <https://discourse.cakephp.org/t/problem-with-sessions-support-for-loading-components-using-components-property-is-removed-use-this-loadcomponent-instead-in-initialize/8390>\
**Category:** Need Help\
**Tags:** release\
**Created:** [September 15, 2020, 9:44pm UTC](https://discourse.cakephp.org/t/problem-with-sessions-support-for-loading-components-using-components-property-is-removed-use-this-loadcomponent-instead-in-initialize/8390 "2020-09-15T21:44:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSG](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@SSG](https://discourse.cakephp.org/u/SSG)\
**Post date:** [September 15, 2020, 9:44pm UTC](https://discourse.cakephp.org/t/problem-with-sessions-support-for-loading-components-using-components-property-is-removed-use-this-loadcomponent-instead-in-initialize/8390/1 "2020-09-15T21:44:04Z")

</div>

Cakephp V4.1.4  
Php 7.3 / MariaDB latest version (migration and new server since 3 weeks.)

After a migration from 3.6 to 4.1, Auth component seem breaked.

I have this message : Support for loading components using $components property is removed. Use $this-\>loadComponent() instead in initialize()

I use Legacy for another hasher, and component is correctly loaded on AppController.php like this :  
$this-\>loadComponent(‘Auth’, [  
‘authenticate’ =\> [  
‘Form’ =\> [  
‘passwordHasher’ =\> [  
‘className’ =\> ‘Legacy’,  
]  
]  
]  
]);

I have two projects, and only this one is breaked. The other run perfectly. Both are on Cakephp 4.1.4.

Regards,

---

<div class="post-metadata">

**Author:** ![dreamingmind](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dreamingmind/32/1857_2.png) [@dreamingmind](https://discourse.cakephp.org/u/dreamingmind)\
**Post date:** [September 15, 2020, 10:36pm UTC](https://discourse.cakephp.org/t/problem-with-sessions-support-for-loading-components-using-components-property-is-removed-use-this-loadcomponent-instead-in-initialize/8390/2 "2020-09-15T22:36:49Z")

</div>

Although you do load the component correctly, do you also have the public `$components` property set? It’s presence may be triggering the warning.

---

<div class="post-metadata">

**Author:** ![SSG](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@SSG](https://discourse.cakephp.org/u/SSG)\
**Post date:** [September 16, 2020, 10:19pm UTC](https://discourse.cakephp.org/t/problem-with-sessions-support-for-loading-components-using-components-property-is-removed-use-this-loadcomponent-instead-in-initialize/8390/3 "2020-09-16T22:19:11Z")

</div>

Ho god ! One file were be corrupted by a bad setup, and I see only the new (without $component var…). The corrupted file contained $component var. So sorry ! And thanks a lot !
