Closed simplenotezy closed 8 years ago
Funny thing is, if I instead do:
$model = My\Models\Model::whereId(1)->first();
or
$model = My\Models\Model::findOrFail(1);
It works
I have tried switching back to the initial 3.0.0 release, but the error is the same. Guess I haven't used ::find()
for a while.
Guess I haven't used find in a while as well, @canfiax. Just so you know: activating throwOnFind
prevents the loop, that's why I never saw it until now :)
It seems the issue is explained on #283. See if it's fixed for you in 3.1.1!
I'm also having this error, but for the version 2.5.0. I had to rollback to version 2.4.2.
@igorsantos07 I have this problem too. I'm using version 3.3.0 and laravel 5.2 (Is it even supposed to work with 5.2?)
When i call find() (or all() and probably any other database action) i get memory exhaused because of a infinite loop:
LaravelArdent\\Ardent\\Ardent::find() /var/www/app/Http/Controllers/BlogController.php:27,
LaravelArdent\\Ardent\\Ardent->__call() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:914,
Illuminate\\Database\\Eloquent\\Model->__call() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:387,
LaravelArdent\\Ardent\\Ardent->newQuery() /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:3546,
LaravelArdent\\Ardent\\Ardent->applyGlobalScopes() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:934,
LaravelArdent\\Ardent\\Ardent->__call() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:934,
Illuminate\\Database\\Eloquent\\Model->__call() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:387,
LaravelArdent\\Ardent\\Ardent->newQuery() /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:3546,
LaravelArdent\\Ardent\\Ardent->applyGlobalScopes() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:934,
LaravelArdent\\Ardent\\Ardent->__call() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:934,
[...]
@ManiacTwister, would you provide us with a gist of the affected model, the table structure, and the exact call you're making? I do use all() and find() but do not face those issues.
Igor Santos -- Desenvolvedor Web [enviado do meu celular] On 15 Jan 2016 15:00, "ManiacTwister" notifications@github.com wrote:
@igorsantos07 https://github.com/igorsantos07 I have this problem too. I'm using version 3.3.0 and laravel 5.2 (Is it even supposed to work with 5.2?)
When i call find() (or all() and probably any other database action) i get memory exhaused because of a infinite loop:
LaravelArdent\Ardent\Ardent::find() /var/www/app/Http/Controllers/BlogController.php:27, LaravelArdent\Ardent\Ardent->call() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:914, Illuminate\Database\Eloquent\Model->call() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:387, LaravelArdent\Ardent\Ardent->newQuery() /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:3546, LaravelArdent\Ardent\Ardent->applyGlobalScopes() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:934, LaravelArdent\Ardent\Ardent->call() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:934, Illuminate\Database\Eloquent\Model->call() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:387, LaravelArdent\Ardent\Ardent->newQuery() /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:3546, LaravelArdent\Ardent\Ardent->applyGlobalScopes() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:934, LaravelArdent\Ardent\Ardent->__call() /var/www/vendor/laravelbook/ardent/src/Ardent/Ardent.php:934, [...]
— Reply to this email directly or view it on GitHub https://github.com/laravel-ardent/ardent/issues/281#issuecomment-172015910 .
Here is the gist: https://gist.github.com/ManiacTwister/0dbb10dd67142e7e1000
I just ran into this issue myself. Looks like laravel/framework@ca15fe7317e6cf3a1a138893c804a9c4196904a5 removed applyGlobalScopes()
and moved it's logic to newQuery()
causing _call()
on the Ardent and Eloquent models to loop.
+1 Same problem. Please fix it.
But i had infinite loop with $model->load('relation_name')
method.
Infinite loop in LaravelArdent\Ardent\Ardent
class
public function newQuery($excludeDeleted = true) {
...
return $this->applyGlobalScopes($builder); // loop in this calling
}
@weyforth got it right, the issue is in the snippet by @shtricul. This is a pretty small fix, related to changed in Laravel between 4 and 5. The weirdest thing is it only happens sometimes, when it should happen every time we do any kind of find, I think.
The fix will be published soon on 3.4.2, as this is a bugfix for an internal API. However, PLEASE use caution when updating, I'm not entire sure it would not bring any troubles with it.
Having run 3.0.0 successfully, after recently updating using
composer update
I get the following error, when I do:Returns:
This worked before running composer update.