From 6c0ed98711eb7ba8fe086b3144701e7f161e1bbc Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Sun, 27 Dec 2015 17:49:21 +0300 Subject: [PATCH 1/2] issue #388 dont share mysqli between copy'ed in subquery --- MysqliDb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MysqliDb.php b/MysqliDb.php index f64c00a0..2b2d6600 100644 --- a/MysqliDb.php +++ b/MysqliDb.php @@ -1731,7 +1731,7 @@ public static function subQuery($subQueryAlias = "") public function copy() { $copy = unserialize(serialize($this)); - $copy->_mysqli = $this->_mysqli; + $copy->_mysqli = null; return $copy; } From 873077a652ec385983c63b2d519b3e5384c5aa23 Mon Sep 17 00:00:00 2001 From: Alexander Butenko Date: Sun, 27 Dec 2015 17:51:14 +0300 Subject: [PATCH 2/2] update copy() test --- tests/mysqliDbTests.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/mysqliDbTests.php b/tests/mysqliDbTests.php index f1fa9efa..cc993391 100644 --- a/tests/mysqliDbTests.php +++ b/tests/mysqliDbTests.php @@ -360,6 +360,8 @@ function createTable ($name, $data) { echo "copy with subquery count failed"; exit; } +unset ($cnt); + $data = $db->get('users'); if (count($data) != 3) { echo "copy with subquery data count failed";