From 1e1155d73db5f0e96a669baefb76a895a15f3772 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Mon, 30 Sep 2019 17:38:49 -0500 Subject: [PATCH] Remove circular reference in destructor --- src/PqUnbufferedResultSet.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PqUnbufferedResultSet.php b/src/PqUnbufferedResultSet.php index 0742ef0..3186973 100644 --- a/src/PqUnbufferedResultSet.php +++ b/src/PqUnbufferedResultSet.php @@ -52,9 +52,10 @@ final class PqUnbufferedResultSet implements ResultSet return; } - asyncCall(function () { + $producer = $this->producer; + asyncCall(static function () use ($producer) { try { - while (yield $this->producer->advance()); + while (yield $producer->advance()); } catch (\Throwable $exception) { // Ignore iterator failure when destroying. }