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

Compatibility issue with LearnDash plugin #303

Open
Swelldev opened this issue Jan 14, 2025 · 3 comments
Open

Compatibility issue with LearnDash plugin #303

Swelldev opened this issue Jan 14, 2025 · 3 comments

Comments

@Swelldev
Copy link

After activating the LearnDash plugin, I get the following 500 server error on my screen.

Cannot assign StellarWP\Learndash\Illuminate\Support\Collection to property Log1x\AcfComposer\Composer::$defaults of type Illuminate\Support\Collection|array

Our understanding is that both are attempting to load their corresponding Illuminate\Support\Collection classes.

Any guidance would be greatly appreciated.

@Log1x
Copy link
Owner

Log1x commented Jan 14, 2025

Does the plugin override the collect() helper? Ideally plugins should always namespace stuff like this. ACF Composer isn't really doing anything wrong since it's installed with Composer and follows a proper chain of dependencies. Plugins on the other hand are the wild west.

@Log1x
Copy link
Owner

Log1x commented Jan 14, 2025

That aside, I'm still open to a PR that introduces a trait similar to https://github.com/Log1x/poet/blob/master/src/Concerns/HasCollection.php and swaps usage of the helper function everywhere.

@Swelldev
Copy link
Author

I just ran a test and it does appear to overwrite the collect() helper.

add_action('init', function () {
    if (function_exists('collect')) {
        $collection = collect(['test']);
        error_log('collect() returns: ' . get_class($collection));
    } else {
        error_log('collect() helper is not defined.');
    }
});

debug.log: collect() returns: StellarWP\Learndash\Illuminate\Support\Collection

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

No branches or pull requests

2 participants