-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Composer replaces class names in plugins with _composer_tmp0
#5237
Comments
_composer_tmp0
_composer_tmp0
Meanwhile, worked around this bug via Ocramius/PackageVersions#16 |
I managed to reproduce this bug thanks to @BarthyB: Given following {
"require": {
"vich/uploader-bundle": "1.0.1",
"ocramius/package-versions": "1.0.3"
}
} Run a Then check <?php
namespace PackageVersions;
/**
* ...
*/
final class Versions
{ Run Check the <?php
namespace PackageVersions;
/**
* ...
*/
final class Versions_composer_tmp0
{ |
…class-parsing Workaround for composer/composer#5237 - class parsing
Effort to leverage the internal tokenizer can be reused in #5239 |
First, note that this happens sporadically, and I didn't yet identify which state transition causes the composer
PluginManager
to do that.Specifically, my plugin looks like following:
Composer seems to generate a temporary class to be passed to
eval()
in some conditions.I cannot reproduce the bug yet, but it seems seems related to optimized classmaps.
The replacement of the class names is done via a regular expression.
The regular expression doesn't recognize the difference between
class MyPlugin
(class definition) andfinal class GeneratedThing
(within a string), and replaces both instances with respectivelyMyPlugin_composer_tmp0
andfinal class GeneratedThing_composer_tmp0
.The offending regex should probably be replaced with AST-aware code.
The text was updated successfully, but these errors were encountered: