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

Classmap issue after update to 2.1.7 #10102

Closed
Webonaute opened this issue Sep 14, 2021 · 7 comments
Closed

Classmap issue after update to 2.1.7 #10102

Webonaute opened this issue Sep 14, 2021 · 7 comments
Labels
Milestone

Comments

@Webonaute
Copy link

I just upgraded to composer 2.1.7 from 2.1.6 and composer classmap cache stopped working or there is some breaking change in new version.

any subsequent command have error like :
Noticed exception 'Error' with message 'Class '\Contract\V1\Config\GPBMetadata\Config' not found' in /var/www/project/vendor/someVendor/Contract/V1/Config/Config.php

only change is upgrading composer to 2.1.7.

here is the command we use in our automations scripts:
su -p -c "composer dump-autoload --optimize --classmap-authoritative --apcu" www-data

@mitelg
Copy link
Contributor

mitelg commented Sep 15, 2021

we are experiencing a similar issue in https://github.com/shopware/shopware

Error: Class 'Smarty_Internal_Compile_Block' not found

are we doing something wrong in our composer.json ?

@mitelg
Copy link
Contributor

mitelg commented Sep 15, 2021

okay, we found out that the issue occurs if the file contains two classes:

https://github.com/shopware/shopware/blob/5.7/engine/Library/Smarty/sysplugins/smarty_internal_compile_block.php

once we split it up in two files, it works correctly again.

@Seldaek Seldaek added this to the 2.1 milestone Sep 15, 2021
@Seldaek Seldaek added the Bug label Sep 15, 2021
@Seldaek
Copy link
Member

Seldaek commented Sep 15, 2021

Thanks @mitelg for the repro case with file. That one was due to the file having invalid unicode sequences. If I open it and save it again it starts working for me, which I guess explains why splitting it in two helped you.

Running a diff pre/post save shows:

104,105c104,105
<                             $search = array("!({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl})([\s\S]*?)({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})([\s\S]*?)({$_ldl}{$al}/block\s*{$_rdl})!", "/§§§child§§§/");
<                             $replace = array('\2§§§child§§§\4', $replacement);
---
>                             $search = array("!({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl})([\s\S]*?)({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})([\s\S]*?)({$_ldl}{$al}/block\s*{$_rdl})!", "/���child���/");
>                             $replace = array('\2���child���\4', $replacement);

So it looks like the � which as per https://www.babelstone.co.uk/Unicode/whatisit.html are apprently U+FFFD : REPLACEMENT CHARACTER aren't very much liked by my editor nor by PCRE. Anyway that should be fixed.

@Webonaute could you check if the snapshot build also fixes your issue? If not please share the source so I can try and repro/debug. You can try with composer self-update --snapshot. Thanks!

@mitelg
Copy link
Contributor

mitelg commented Sep 15, 2021

oh, what a strange problem 🙈 😄

thank you so much for the fast fix! I tested the snapshot version, and can confirm it worked again for us 😊 👍 🎉

@astepin
Copy link

astepin commented Sep 15, 2021

I can also confirm that the problem is fixed with the latest snapshot. It is quite easy to encounter this problem when developing with Windows.

@Seldaek
Copy link
Member

Seldaek commented Sep 15, 2021

https://github.com/composer/composer/releases/tag/2.1.8 is out with the fix.

@Webonaute
Copy link
Author

Thank. I confirm issue is fixed with 2.1.8 for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants