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

[Validator] Fix LazyLoadingMetadataFactory with PSR6Cache for non classname if tested values isn't existing class#26823

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
nicolas-grekas merged 2 commits intosymfony:2.7frompmontoya:bug-26313
Apr 9, 2018

Conversation

@pmontoya
Copy link

@pmontoyapmontoya commentedApr 5, 2018
edited by nicolas-grekas
Loading

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#26313
LicenseMIT

If@Assert\Valid is applied to a string value, the value is searched in metadata cache and some characters aren't allowed in this cache. This create an unexpected exception.

Class existence is now tested before cache read.

dmaicher reacted with thumbs up emoji
@dmaicher
Copy link
Contributor

dmaicher commentedApr 5, 2018
edited
Loading

Symfony 3.1 is not maintained anymore 😉 I guess the lowest maintained affected branch is 3.4? Before that there is no PSR-6 Cache.

But I think its fine to target even 2.7 for consistency? I would wait for a symfony member to confirm 😉

->method('read')
->with($testedValue)
->willThrowException(newInvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:',$testedValue)));
$this->expectException(NoSuchMetadataException::class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

if we target 2.7 then we need to support php 5.3 here

$cache
->method('read')
->with($testedValue)
->willThrowException(newInvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:',$testedValue)));
Copy link
Contributor

@dmaicherdmaicherApr 5, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

just assert that we never actually call$cache->read(...)?

$this->expectException(NoSuchMetadataException::class);
try {
$factory->getMetadataFor($testedValue);
}catch (InvalidArgumentException$exception) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

no need for this then. We expectNoSuchMetadataException::class and if not the test just fails

@pmontoyapmontoya changed the base branch from3.1 to2.7April 6, 2018 05:52
@pmontoya
Copy link
Author

@dmaicher : Sorry. Too worried to not forget a comment, to find the right way to create patchs and I forgot the most important : the bug... 😄
Thanks for your comments

dmaicher reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas changed the title[Validator] Fix LazyLoadingMetadataFactory with PSR6Cache for non cla…[Validator] Fix LazyLoadingMetadataFactory with PSR6Cache for non classname if tested values isn't existing classApr 6, 2018
return$this->loadedClasses[$class];
}

if (!class_exists($class) && !interface_exists($class)) {
Copy link
Member

@nicolas-grekasnicolas-grekasApr 7, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

just one change please:false should be passed as 2nd arg tointerface_exists() (no need to trigger autoloader twice)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

done

@nicolas-grekas
Copy link
Member

Thank you@pmontoya.

@nicolas-grekasnicolas-grekas merged commit5198f43 intosymfony:2.7Apr 9, 2018
nicolas-grekas added a commit that referenced this pull requestApr 9, 2018
…for non classname if tested values isn't existing class (Pascal Montoya, pmontoya)This PR was merged into the 2.7 branch.Discussion----------[Validator] Fix LazyLoadingMetadataFactory with PSR6Cache for non classname if tested values isn't existing class| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#26313| License       | MITIf@Assert\Valid is applied to a string value, the value is searched in metadata cache and some characters aren't allowed in this cache. This create an unexpected exception.Class existence is now tested before cache read.Commits-------5198f43 Disable autoloader call on interface_exists checkcd91420 [Validator] Fix LazyLoadingMetadataFactory with PSR6Cache for non classname if tested values isn't an existing class
@pmontoyapmontoya deleted the bug-26313 branchApril 15, 2018 17:22
This was referencedApr 27, 2018
This was referencedApr 30, 2018
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

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@dmaicherdmaicherdmaicher approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

5 participants

@pmontoya@dmaicher@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp