Skip to content

[RateLimiter] [XML] The attribute 'policy' is not allowed. #49671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dbknet opened this issue Mar 13, 2023 · 1 comment
Closed

[RateLimiter] [XML] The attribute 'policy' is not allowed. #49671

dbknet opened this issue Mar 13, 2023 · 1 comment

Comments

@dbknet
Copy link

dbknet commented Mar 13, 2023

Symfony version(s) affected

5.4+

Description

I'm using the XML version config.

<framework:config>
    <framework:rate-limiter>
        <framework:limiter name="access_setting_update"
               policy="sliding_window"
               limit="30"
               interval="3 minutes"
        />
    </framework:rate-limiter>
</framework:config>

The application works, but calling debug:container causes the error below.

[ERROR 1866] Element '{http://symfony.com/schema/dic/symfony}limiter', attribute 'policy': The attribute 'policy' is not allowed. (in /var/www/ - line 16, column 0)

Further digging in the code led me to a probable error in the XSD. The policy attribute does not appear in XSD, but we see strategy. When we use strategy we get the following error within the whole application.

Unrecognized option "strategy" under "framework.rate_limiter.limiters.access_setting_update". Available options are "cache_pool", "interval", "limit", "lock_factory", "policy", "rate", "storage_service".

How to reproduce

  1. Install Rate Limiter
  2. Setup configuration in XML
  3. Run debug:container console command

Possible Solution

Change attribute strategy to policy in rate_limiter_limiter section in symfony-1.0.xsd.

Additional Context

No response

@dbknet dbknet added the Bug label Mar 13, 2023
@fabpot fabpot closed this as completed Mar 13, 2023
fabpot added a commit that referenced this issue Mar 13, 2023
…in XSD (MatTheCat)

This PR was merged into the 5.4 branch.

Discussion
----------

[FrameworkBundle] Rename limiter’s `strategy` to `policy` in XSD

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #49671
| License       | MIT
| Doc PR        | N/A

#38664 renamed `strategy` to `policy` but did not update the XSD.

Commits
-------

c19711c [FrameworkBundle] Rename limiter’s `strategy` to `policy` in XSD
@dbknet
Copy link
Author

dbknet commented Mar 13, 2023

Thanks for quick solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants