CakeDC / users

Users Plugin for CakePHP
https://www.cakedc.com
Other
521 stars 296 forks source link

CakePHP 4.3 deprecation #972

Closed challgren closed 2 months ago

challgren commented 2 years ago

When running CakeDC/Users version 9.2.1 and CakePHP 4.3.1 the following message is outputted

CAKE/Core/functions.php:322
Colon prefixed route placeholders like `:foo` are deprecated. Use braced placeholders like `{foo}` instead. - /var/www/html/vendor/cakephp/cakephp/src/Routing/Route/Route.php, line: 300 You can disable all deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED`, or add `vendor/cakephp/cakephp/src/Routing/Route/Route.php` to `Error.ignoredDeprecationPaths` in your `config/app.php` to mute deprecations from only this file.

When investigating this the following file is the one that has the colon prefixed route placeholder. https://github.com/CakeDC/users/blob/master/config/routes.php#L48-L52

Changing those lines from

$routes->connect('/social-accounts/:action/*', [
    'plugin' => 'CakeDC/Users',
    'controller' => 'SocialAccounts',
]);
$routes->connect('/users/:action/*', UsersUrl::actionRouteParams(null));

to

$routes->connect('/social-accounts/{action}/*', [
    'plugin' => 'CakeDC/Users',
    'controller' => 'SocialAccounts',
]);
$routes->connect('/users/{action}/*', UsersUrl::actionRouteParams(null));

removes the deprecation notice.

skie commented 2 years ago

It should be solved in 11.next-cake4, which is WIP for cakephp 4.3+

umer936 commented 2 years ago

Is this ready to be in a release version?

ajibarra commented 2 months ago

@challgren @umer936 can you confirm this has been fixed in latest version?

challgren commented 2 months ago

@challgren @umer936 can you confirm this has been fixed in latest version?

Not sure I've upgraded to cake 5 and the latest users plug-in