Skip to content
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

[SecurityBundle] Allow an array of pattern in firewall configuration #51128

Merged
merged 1 commit into from
Jul 29, 2023

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented Jul 27, 2023

Q A
Branch? 6.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets
License MIT
Doc PR symfony/symfony-docs#18617

allow this :

 security:
     firewalls:
         no_security:
-            pattern: "^/(register|documentation)$"
+            pattern:
+                - "^/register$"
+                - "^/documentation$"

/**
 * @Revs(100)
 * @Iterations(100)
 */
class RegexBench
{
    public function benchOneBigString()
    {
        preg_match("{^/(register|documentation)$}", "/register");
        preg_match("{^/(register|documentation)$}", "/foo");
    }

    public function benchArrayConcat()
    {
        preg_match("{(?:^/register$|^/documentation$)}", "/register");
        preg_match("{(?:^/register$|^/documentation$)}", "/foo");
    }
}

=>

PHPBench (dev-master) running benchmarks... #standwithukraine                                                                                                                                
with configuration file: /home/gregoire/dev/github.com/lyrixx/php-bench/phpbench.json                                                                                                        
with PHP version 8.2.8, xdebug ❌, opcache ✔                                                                                                                                                 
                                                                                                                                                                                             
\RegexBench                                                                                                                                                                                  
                                                                                                                                                                                             
    benchOneBigString.......................I99 - Mo0.670μs (±17.85%)                                                                                                                        
    benchArrayConcat........................I99 - Mo0.664μs (±12.49%)                                                                                                                        
                                                                                                                                                                                             
Subjects: 2, Assertions: 0, Failures: 0, Errors: 0                                                                                                                                           
+-------------------+---------+-----------+                                                                                                                                                  
| subject           | mean    | mem_peak  |                                                                                                                                                  
+-------------------+---------+-----------+                                                                                                                                                  
| benchOneBigString | 0.716μs | 995.920kb |                                                                                                                                                  
| benchArrayConcat  | 0.707μs | 995.920kb |                                                                                                                                                  
+-------------------+---------+-----------+  

@chalasr
Copy link
Member

chalasr commented Jul 29, 2023

Thank you @lyrixx.

@chalasr chalasr merged commit 60e7a5d into symfony:6.4 Jul 29, 2023
@lyrixx lyrixx deleted the security-patternS branch July 29, 2023 08:17
javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Jul 31, 2023
…configuration (alexandre-daubois)

This PR was merged into the 6.4 branch.

Discussion
----------

[Security] Allow an array of pattern in firewall configuration

Related to symfony/symfony#51128

Commits
-------

66a7330 [SecurityBundle] Allow an array of pattern in firewall configuration
OskarStark added a commit to symfony/symfony-docs that referenced this pull request Aug 1, 2023
…guration (alexandre-daubois)

This PR was merged into the 6.4 branch.

Discussion
----------

[Security] Allow an array of pattern in firewall configuration

Related to symfony/symfony#51128

Commits
-------

66a7330 [SecurityBundle] Allow an array of pattern in firewall configuration
This was referenced Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants