laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.2k stars 10.89k forks source link

\Illuminate\Database\Eloquent\Concerns\PreventsCircularRecursion use \Illuminate\Support\Onceable who has a laravel dependency #52828

Open alepieser opened 2 days ago

alepieser commented 2 days ago

Laravel Version

11.22.0

PHP Version

8.3.0

Database Driver & Version

No response

Description

Hello,

On different projects, we are using eloquent as standalone package. Everything was working well since the release v11.22.0.

In this release, a refactoring was done and introduce a new trait Eloquent/Concerns/PreventsCircularRecursion.php. This trait is using the class Onceable from package Support

$onceable = Onceable::tryFromTrace($trace, $callback);

The class Onceable is using use \Laravel\SerializableClosure\Support\ReflectionClosure. As we don't have laravel as dependency, we cannot upgrade illuminate/database depdendency.

Do you think that there is a chance to solve this issue ?

Sorry if I didn't write at the right place to report this issue.

Thanks

Steps To Reproduce

You can take look on line 6 file of Onceable.php

github-actions[bot] commented 1 day ago

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

crynobone commented 1 day ago

Shouldn't you be able to just run composer require "laravel/serializable-closure:^1.3"?

alepieser commented 1 day ago

Thanks for your reply. I didn't know it was a standalone package. I just tested and it solved the issue.

However, what do you think about to update the requirement of illuminate/support to include it ?

crynobone commented 1 day ago

It is already suggested in illuminate/support: https://packagist.org/packages/illuminate/support

alepieser commented 1 day ago

Ah ok ! Sorry I didn't check that.

What about this time to add it in illuminate/database ? Because it's this package who is using the once function