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

[DI] Fix Cannot declare class ...\DefinitionDecorator, because the name is already in use#22657

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
fabpot merged 1 commit intosymfony:masterfromogizanagi:fix/3.3/child_def_bc_layer
May 7, 2017
Merged

[DI] Fix Cannot declare class ...\DefinitionDecorator, because the name is already in use#22657

fabpot merged 1 commit intosymfony:masterfromogizanagi:fix/3.3/child_def_bc_layer
May 7, 2017

Conversation

@ogizanagi
Copy link
Contributor

@ogizanagiogizanagi commentedMay 7, 2017
edited
Loading

QA
Branch?3.3
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#21369
LicenseMIT
Doc PRN/A

Thereturn trick doesn't seem to work, and php is still trying to declare theDefinitionDecorator class, which causes the "Cannot declare class ...\DefinitionDecorator, because the name is already in use" error because of theclass_alias previously declared inChildDefinition.php.

This never happens as soon as theChildDefinition class is used first, as the alias will take hand, but their are some situations, like in some unit test cases it can happen apparently, becauseDefinitionDecorator is used first.

chalasr and scaytrase reacted with thumbs up emoji
@ogizanagi
Copy link
ContributorAuthor

Here is the fixed reproducer build on Travis:https://travis-ci.org/ogizanagi/symfony-21369/builds/229639096

Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

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

Preserving autocompletion as well 👍

@fabpot
Copy link
Member

Thank you@ogizanagi.

@fabpotfabpot merged commit530849e intosymfony:masterMay 7, 2017
fabpot added a commit that referenced this pull requestMay 7, 2017
…ause the name is already in use (ogizanagi)This PR was merged into the 3.3-dev branch.Discussion----------[DI] Fix Cannot declare class ...\DefinitionDecorator, because the name is already in use| Q             | A| ------------- | ---| Branch?       | 3.3| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#21369| License       | MIT| Doc PR        | N/AThe `return` trick doesn't seem to work, and php is still trying to declare the `DefinitionDecorator` class, which causes the "Cannot declare class ...\DefinitionDecorator, because the name is already in use" error because of the `class_alias` previously declared in `ChildDefinition.php`.This never happens as soon as the `ChildDefinition` class is used first, as the alias will take hand, but their are some situations, like in some unit test cases it can happen apparently, because `DefinitionDecorator` is used first.Commits-------530849e [DI] Fix Cannot declare class ...\DefinitionDecorator, because the name is already in use
@ogizanagiogizanagi deleted the fix/3.3/child_def_bc_layer branchMay 7, 2017 15:22
@xabbuh
Copy link
Member

Don't we have other places where we follow the same approach?

@ogizanagi
Copy link
ContributorAuthor

ogizanagi commentedMay 7, 2017
edited
Loading

@xabbuh : You probably mean theTraceableAccessDecisionManagerandDebugAccessDecisionManager. Actually we did not try to redeclare theDebugAccessDecisionManager class inDebugAccessDecisionManager.php on the contrary of theDefinitionDecorator in this PR. Do you think we missed it, or is it not required?

@ogizanagi
Copy link
ContributorAuthor

I guess it is actually, for the same reasons as here: composer classmap and theclassmap-authoritative strategy. See#22664.

fabpot added a commit that referenced this pull requestMay 11, 2017
…sDecisionManager BC layer (ogizanagi)This PR was merged into the 3.3-dev branch.Discussion----------[Security] Fix TraceableAccessDecisionManager / DebugAccessDecisionManager BC layer| Q             | A| ------------- | ---| Branch?       | 3.3| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#22657 (comment)| License       | MIT| Doc PR        | N/ASame as#22657 for the renaming of `DebugAccessDecisionManager` into `TraceableAccessDecisionManager`. Indeed, I think we also require to redeclare the old `DebugAccessDecisionManager` for composer `classmap-authoritative` autoloading strategy & classmap dumper.AppVeyor failures unrelated.Edit: Re-thinking about it, it's probably not very common to dump the classmap and use the `classmap-authoritative` strategy when using those classes... That's to say: in debug mode/dev env. So it may be the reason why the class wasn't redeclared on contrary of `DefinitionDecorator`.Commits-------5b123b9 [Security] Fix TraceableAccessDecisionManager / DebugAccessDecisionManager BC layer
@fabpotfabpot mentioned this pull requestMay 17, 2017
fabpot added a commit to twigphp/Twig that referenced this pull requestJun 5, 2017
This PR was merged into the 1.x branch.Discussion----------Use class_exists instead of requireI think this is required forsymfony/symfony#23073 to pass. It's probably very similar tosymfony/symfony#22657.A simple reproducer:```php<?phpuse Twig\Node\Node;require_once __DIR__ . '/vendor/autoload.php';new Node();new \Twig_Node();```[Without this patch](https://travis-ci.org/symfony/symfony/jobs/239712676#L2100):```phpPHP Fatal error:  Cannot declare class Twig_Node, because the name is already in use in vendor/twig/twig/lib/Twig/Node.php on line 20```With, everything works fine, whatever the two calls order.Commits-------2c174e4 Use class_exists instead of require
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@ogizanagi@fabpot@xabbuh@chalasr

[8]ページ先頭

©2009-2025 Movatter.jp