From f6ad9043c0472619ff45de19a20381fcf99e0a98 Mon Sep 17 00:00:00 2001 From: Igor Santos Date: Mon, 30 Nov 2015 03:39:14 -0200 Subject: [PATCH] Fixing memory exhaustion in find() Closes #283 and #191 --- src/Ardent/Ardent.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Ardent/Ardent.php b/src/Ardent/Ardent.php index 8773ce2..c13da5e 100755 --- a/src/Ardent/Ardent.php +++ b/src/Ardent/Ardent.php @@ -908,7 +908,8 @@ public static function find($id, $columns = array('*')) { if (static::$throwOnFind && $debug[1]['function'] != 'findOrFail') { return self::findOrFail($id, $columns); } else { - return parent::find($id, $columns); + //mimicking Eloquent's __callStatic() + __call() behaviour so we don't loop forever + return (new static)->__call('find', [$id, $columns]); } }