Drupal 10.2.3
I tried to update fron beta6 to beta7
First attempt:
composer update drupal/access_policy --with-all-dependencies
No change: beta6 remains
Second attempt:
composer require drupal/access_policy:1.0.0-beta7
Error when I open the site
The website encountered an unexpected error. Try again later.
ArgumentCountError: Too few arguments to function Drupal\access_policy\AccessPolicyValidator::__construct(), 3 passed in /home/../mysitefolder/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 4 expected in Drupal\access_policy\AccessPolicyValidator->__construct() (line 75 of modules/contrib/access_policy/src/AccessPolicyValidator.php).
Is there a bug or did I update in a wrong way? (I did the same way with another module and it worked)
Comments
Comment #2
gilbertdelyon commentedComment #3
partdigital commentedHi gilbertdelyon, did you clear the cache?
Comment #4
gilbertdelyon commentedThis is what I did:
In a Production site (D10.2.3)
- In admin >config > performance > clear the cache
console:
composer update drupal/access_policyback to the site admin
Clear the cache again
Admin > extensions
Access_policy Beta6 is still there (with your last patch!)
In a test site on same server (D10.2.2 with only a few modules - nearly empty site))
Same process
composer update drupal/access_policyAfter update I go back to site and get this error
Back to console
Downgrade to beta6. It works
Comment #5
gilbertdelyon commentedNotice: same process for other modules updating. No issue.
Comment #6
partdigital commentedWould you mind sharing any access policies that you have?
Comment #7
gilbertdelyon commentedSee attached document
(I have only one policy)
Comment #8
gilbertdelyon commentedNotice:
Previous post was for Production site 'D10.2.3)
In Test site (D10.2.2) Access_Policy is installed but not configured (no policy)
Comment #9
partdigital commentedThank you.
Unfortunately I still can't reproduce it.
It's a very odd error because nothing changed in regards to the 403 http response. It sounds like it may be another issue with a mysterious cause unique to your environment (similar to #3419046). Perhaps it's conflicting with a contrib module? Are you able to reproduce the error on a vanilla Drupal 10 site?
Comment #10
rishabjasrotia commentedHello,
As per understanding from version 1.0.0-beta6 to 1.0.0-beta7
We can see that now services have new parameters introduced.
In version 1.0.6
In version 1.0.7 we have additional parameter
My question is to @gilbertdelyon are you using this service access_policy.validator somewhere in your custom module?
Also @partdigital we still need to fix the Test cases where service is using only 3 parameters for testing.
Comment #11
gilbertdelyon commented@partdigital
In my test site:
I uninstalled all none core modules (except Access_policy beta6)
I updated to D10.2.3
Update.php
run cron
admin > config > delete cache
Then in terminal
composer update drupal.access_policyback to admin > extensions
Access_policy beta6 is still there
Next step: I will reinstall a fresh D10.2.3 release and test again
@rishabjasrotia
No, I dont use any kind of access_policy service in my custom modules
Comment #12
partdigital commented@gilbertdelyon one thing I forgot to ask earlier. Did you run
drush updb? That will update all your access policies with the new operations.Here are the steps that I went through to upgrade one of our projects to beta7.
@rishabjasrotia which tests are you referring too? All tests are currently passing.
Comment #13
gilbertdelyon commented@partigital
Sorry I dont use drush yet.
but as you can see in my previous comment
When I enter
composer update drupal/access_policyI get this answer in terminal:
Strange that there is Nothing to modify in lock file and Nothing to install, update or remove
Then when I open foldersite/composer.json this what I see
Comment #14
partdigital commentedAh ok I hadn't realized that you weren't using drush. That's good to know for future updates. I just it ran the update against update.php and it seemed to work as well.
In regards to the composer update did you try it with:
In some cases I might also do it like this:
Note that I've never seen composer used like
composer update drupal.access_policy. When I rancomposer update drupal/access_policyit updated successfully.Here is a comparison of the messages between the two commands:
composer update drupal.access_policy --with-all-dependencies
composer update drupal/access_policy --with-all-dependencies
Comment #15
gilbertdelyon commentedOups, Sorry, keyboard error from my side. You are right, i also use
composer update drupal/access_policy.Another test:
Access_policy beta 6 is installed.
admin>extends>uninstall access_policy
composer remove drupal/access_policynow the site is clear from any access_policy elements.
composer require drupal/access_policy:1.0.0-beta6admin>extends>install access_policy
it works but I dont set any rule
composer update drupal/access_policyVery strange!
Then admin > extend > uninstall access_policy
composer remove drupal/access_policycomposer require drupal/access_policy:1.0.0-beta7admin>extends>install access_policy
it works!
Notice that I have used composer this way to update contrib modules and this is the first time there is an issue.
Comment #16
gilbertdelyon commentedFinally I removed all elements of access_policy module in folder and db, installed beta7 version, reconfigure the rules
It was a pain, but it woks!
Comment #17
partdigital commentedGlad to hear you were able to update the module!
Since it doesn't seem any code changes are necessary I'll close this as "Works as designed."
Comment #18
gilbertdelyon commentedOK,
But I am now waiting for the next release and see if the same issue occurs again.
Because in a fresh D10.2.3 with no other module than AP (free of any rule) I couldn't update from beta 6 to beta7 with
composer update drupal/access_policywhile I had no issue in other modules with same procedure.Wait and see!
Comment #19
mero.s commentedExactly the same problem I have now when I update the module to beta9 from beta6. Unfortunately I can't just uninstall the old configuration along with the module, installing and configuring it all over again.
Comment #20
mero.s commentedWhen trying to run drush updb I get the following error: ArgumentCountError: Too few arguments to function Drupal\access_policy\AccessPolicyValidator::__construct(), 3 passed and exactly 4 expected in Drupal\access_policy\AccessPolicyValidator->__construct() (line 75 of /app/web/modules/contrib/access_policy/src/AccessPolicyValidator.php).
When I try to access the site, I get this error:
Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service “access_policy.validator”, path: “access_policy.validator -> exception.access_policy_html”. in Drupal\Component\DependencyInjection\Container->get() (line 149 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Comment #21
partdigital commentedHi mero.s
There are a lot of changes between beta6 and beta9. Did you attempt to upgrade to beta7 first?
Comment #22
mero.s commentedYes, I upgraded to version 7 beta and the error is the same. So this is the problem with this particular version.
Comment #23
partdigital commentedAre you willing to share the access policies you are trying to upgrade? I can perhaps provide some guidance on how to upgrade it manually.