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

Fix aliases when used with preloader #27

Merged
merged 2 commits into from
Jan 26, 2022

Conversation

pbojan
Copy link
Contributor

@pbojan pbojan commented Jan 25, 2022

The opcache preloader is not a fan of the class_alias:

nginx_1          | 2022/01/25 14:56:10 [error] 25#25: *119 FastCGI sent in stderr: "PHP message: PHP Warning:  Cannot declare interface Assetic\Asset\AssetInterface, because the name is already in use in /www/foe/libs/external/assetic/framework/src/aliasing.php on line 17PHP message: PHP Warning:  Cannot declare interface Assetic\Asset\AssetCollectionInterface, because the name is already in use in /www/foe/libs/external/assetic/framework/src/aliasing.php on line 22PHP message: PHP Warning:  Cannot declare interface Assetic\Cache\CacheInterface, because the name is already in use in /www/foe/libs/external/assetic/framework/src/aliasing.php on line 27PHP message: PHP Warning:  Cannot declare interface Assetic\Exception\Exception, because the name is already in use in /www/foe/libs/external/assetic/framework/src/aliasing.php on line 32PHP message: PHP Warning:  Cannot declare interface Assetic\Factory\Loader\FormulaLoaderInterface, because the name is already in use in /www/foe/libs/external/assetic/framework/src/aliasing.php on line 37PHP message: PHP Warning:  Cannot declare interface Assetic\Resource\IteratorResourceInterface, because the name is already in use in /www/foe/libs/external/assetic/framework/src/aliasing.php on line 42PHP message: PHP Warning:  Cannot declare interface Assetic\Resource\ResourceInterface, because the name is already in use in /www/foe/libs/external/assetic/framework/src/aliasing.php on line 47PHP message: PHP Warning:  Cannot declare interface Assetic\Worker\WorkerInterface, because the name is already in use in /www/foe/libs/external/assetic/framework/src/aliasing.php on line 52PHP message: PHP Warning:  Cannot declare interface Assetic\Filter\DependencyExtractorInterface, because the name is already in use in /www/foe/libs/external/assetic/framework/src/aliasing.php on line 57PHP message: PHP Warning:  Cannot declare interface Assetic\Filter\FilterInterface, because the name is already in use in /www/foe/libs/external/assetic/framework/src/aliasing.php on line 62PHP message: PHP Warning:  Cannot dec

@pbojan pbojan requested a review from a team as a code owner January 25, 2022 15:12
src/aliasing.php Outdated Show resolved Hide resolved
Copy link
Member

@jaxwilko jaxwilko left a comment

Choose a reason for hiding this comment

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

A better option might be just asking opcache if the file has been cached.

if (function_exists('opcache_is_script_cached') && opcache_is_script_cached(__FILE__)) {
    return;
}

But the current changes should work and this way it'll stop the any issues caused by the file being required multiple times.

@jaxwilko
Copy link
Member

Btw the failing test is unrelated to this change and patched in #28

@pbojan
Copy link
Contributor Author

pbojan commented Jan 26, 2022

Thank you for the quick reviews! Do you require any action from my-side or you can merge the PR after #28 is merged?

@jaxwilko
Copy link
Member

@pbojan no problem :). The's no conflicts between the 2 PRs so no action required on your side, thanks for raising this PR!

@LukeTowers LukeTowers merged commit a39be45 into assetic-php:master Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants