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

Skip class_alias() declarations when interfaces were already declared, allowing for usage with preloading #141

Merged
merged 2 commits into from
Jun 29, 2022

Conversation

LucasHantz
Copy link
Contributor

@LucasHantz LucasHantz commented Jun 28, 2022

Signed-off-by: Lucas Hantz lucas.hantz@gmail.com

Fixes #128
Closes #143

Signed-off-by: Lucas Hantz <lucas.hantz@gmail.com>
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

@LucasHantz please check inline CI reported errors (you can run vendor/bin/phpcbf on that file, if that makes it simpler.

@boesing what's your opinion on this? Should we check if something was autoloaded? This will fix preloading, but it could indeed backfire if somebody else declared those interfaces, and they aren't what we expect (full crash, in that case).

Signed-off-by: Lucas Hantz <lucas.hantz@gmail.com>
@LucasHantz
Copy link
Contributor Author

Updated with the proper code style

@boesing
Copy link
Member

boesing commented Jun 29, 2022

@Ocramius TBH: if somebody already used class_alias for whatever reason, that might not be our problem.

We either have those users who complain about doing class_alias here without a condition or the users who complain about having crashes in their application because whatever other library had used class_alias to link to non-PSR interfaces (which might be a super edge-case hopefully).

So lets take that pill and see how that works 🤷🏼‍♂️

@Ocramius Ocramius removed the Bug Something isn't working label Jun 29, 2022
@Ocramius Ocramius changed the title Fix issue with opcache preload and class_alias Skip class_alias() declarations when interfaces were already declared, allowing for usage with preloading Jun 29, 2022
@Ocramius Ocramius merged commit 6f96556 into laminas:3.13.x Jun 29, 2022
@Ocramius
Copy link
Member

Decided to treat this as feature/compatibility with preloading, hence moving this to 3.13.0 👍

Thanks @LucasHantz

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

Successfully merging this pull request may close these issues.

Cannot declare interface Interop\Container\Exception\NotFoundException, because the name is already in use
3 participants