Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RequestMatcher issue when_controller is a closure#40807

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Nyholm merged 1 commit intosymfony:4.4fromPlopix:fix-request-matcher
Apr 15, 2021
Merged

RequestMatcher issue when_controller is a closure#40807

Nyholm merged 1 commit intosymfony:4.4fromPlopix:fix-request-matcher
Apr 15, 2021

Conversation

@Plopix
Copy link
Contributor

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
LicenseMIT

Description

If thematches method ofRequestMatcher is used on an attribute which is a closure it crashes.

How did we get it

On a project that is using FOS HTTP Cache, we have this configuration

fos_http_cache:cache_control:rules:     -match:attributes:{ _controller: ^App\\Controller\\.*::.* }headers:overwrite:truecache_control:{ public: true, private: false, must_revalidate: true, s_maxage: 3600 }

Everything works fine unless you are reaching a controller that is a closure.
You get a
TypeError: preg_match(): Argument #2 ($subject) must be of type string, Closure given which is to me logical.

Proposed solution

Just testing the type of attribute value and return false before crashingpreg_match

This PR adds a quick unit test to enforce this.

@nicolas-grekasnicolas-grekas added this to the4.4 milestoneApr 13, 2021
@nicolas-grekasnicolas-grekas changed the base branch from5.x to4.4April 13, 2021 20:03
@PlopixPlopix changed the titleRequestMatcher issue when_controller is a closure[HttpFoundation] RequestMatcher issue when_controller is a closureApr 13, 2021
@carsonbot
Copy link

Hey!

I think@a-menshchikov has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@carsonbotcarsonbot changed the title[HttpFoundation] RequestMatcher issue when_controller is a closureRequestMatcher issue when_controller is a closureApr 14, 2021
@Nyholm
Copy link
Member

Lovely, thank you!

Plopix reacted with laugh emoji

@NyholmNyholm merged commitd5e8d6e intosymfony:4.4Apr 15, 2021
This was referencedMay 1, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

5 participants

@Plopix@carsonbot@Nyholm@nicolas-grekas@chalasr

[8]ページ先頭

©2009-2025 Movatter.jp