laravel / scout

Laravel Scout provides a driver based solution to searching your Eloquent models.
https://laravel.com/docs/scout
MIT License
1.57k stars 336 forks source link

Infinite loop in AsPivot::newQueryForRestoration when indexing a custom MorphPivot model #856

Closed stephenr85 closed 3 months ago

stephenr85 commented 3 months ago

Scout Version

10.11.1

Scout Driver

Meilisearch

Laravel Version

10.48.16

PHP Version

8.2

Database Driver & Version

No response

SDK Version

1.9

Meilisearch CLI Version

1.6.2

Description

I have a model that extends MorphPivot, and the MakeSearchable job fails due to the following error:

local.ERROR: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '512' frames {"exception":"[object] (Error(code: 0): Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '512' frames at /Users/stephen/Workspaces/frameworks/thingson.tv/things-on-tv/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php:278

Steps To Reproduce

Create a model that extends MorphPivot.

MyPivotModel::first()->searchable();

driesvints commented 3 months ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

stephenr85 commented 3 months ago

How is this not a bug with the library? I don't get this error on other models. It appears to be a bug with the library indexing Morph Pivot models. I removed everything from my model except boilerplate to make sure it wasn't something else problematic in my model.

On Thu, Aug 22, 2024, 01:44 Dries Vints @.***> wrote:

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

— Reply to this email directly, view it on GitHub https://github.com/laravel/scout/issues/856#issuecomment-2303904120, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOKMYV3W3RP7G3A7AN6WTZSWCE3AVCNFSM6AAAAABM4NZMOKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBTHEYDIMJSGA . You are receiving this because you authored the thread.Message ID: @.***>