acl icon indicating copy to clipboard operation
acl copied to clipboard

Cannot install using Composer with CakePHP4

Open umer936 opened this issue 4 years ago • 10 comments

CakePHP: 4.2.3 PHP: 8.0.1 Composer: 2.0.9 OS: Windows 10

Hello, I'm attempting to include the Acl plugin. However, when I run composer require cakephp/acl it selects Acl version 0.6.0, which requires CakePHP ^3.8.2, but that does not include CakePHP 4+

So I manually selected Acl version 0.7.0 composer require "cakephp/acl:^0.7.0" Which leads to the error: [InvalidArgumentException] Package cakephp/acl at version 0.7.0 has a PHP requirement incompatible w ith your PHP version, PHP extensions and Composer version

Is there a different way I should be adding the plugin?

umer936 avatar Jan 28 '21 22:01 umer936

The ACL plugin has not been updated for PHP8. Any chance you are interested in helping with that?

markstory avatar Jan 29 '21 02:01 markstory

Ah, I see. Tbh I'm not well versed in CakePHP or the ACL plugin. I may give it a shot after I get a little more experience in a week or 2, unless someone beats me to it.

umer936 avatar Jan 29 '21 16:01 umer936

Is updating this to use PHP 8 in the works or is this project dead?

scs2771 avatar Jun 21 '21 16:06 scs2771

Is updating this to use PHP 8 in the works or is this project dead?

There is no active work to update this to PHP8. As a community run project it can only really die when people stop contributing :) If you'd like to help improve the PHP8 compatibility I'm happy to do reviews, merge changes and tag releases but I don't have much time to devote to this project beyond that.

markstory avatar Jun 21 '21 19:06 markstory

I will talk it over with my team. We are currently down to 3 or 4 projects still using acls. We look to see if it would be best to move to what our other projects are using or update this plugin.

scs2771 avatar Jun 21 '21 19:06 scs2771

@scs2771 I think it would not be too difficult to upgrade it; however, I realized that I didn't need to as we use PHP 7.4, not PHP 8. Additionally, our other sites are using TinyAuth or CakeDC Users plugin instead of Acl.

umer936 avatar Jun 22 '21 02:06 umer936

Are there any known issues with PHP 8? I run this plugin on php 8 without any issues so far. Am I missing something?

nook24 avatar Nov 03 '21 09:11 nook24

Any news regarding this?

matteorebeschi avatar May 09 '22 13:05 matteorebeschi

I'm happy to attempt this.

The main PHP-8 compatibility issue is

[Deprecated (8192)]: ctype_digit(): Argument of type App\Model\Entity\User will be interpreted as string in the future [in /app/vendor/cakephp/acl/src/Model/Table/AclNodesTable.php, line 60]

which is in src/Model/Table/AclNodesTable.php caused by

        } elseif (is_int($ref) || ctype_digit($ref)) {

I've run the testsuite and there are no tests that cover the ctype_digit condition. So I'm sure casting $ref to string will be appropriate.

lilHermit avatar Jul 03 '22 14:07 lilHermit

PR created for this https://github.com/cakephp/acl/pull/173

lilHermit avatar Jul 16 '22 08:07 lilHermit

Shouldn't this be closed by now since #173 has already been merged?

mmahgoub avatar Sep 10 '23 16:09 mmahgoub