From 74788bd77d064e83f64bd9e5c9d2c645d9975701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20M=C3=AD=C5=A1ek?= Date: Sat, 8 Oct 2022 15:42:18 +0200 Subject: [PATCH] pdo statement execute fix - closing pending reader if there are two or more prepared statements executed - fixes https://github.com/peachpiecompiler/peachpie/issues/1069 --- src/PDO/Peachpie.Library.PDO/PDOStatement.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/PDO/Peachpie.Library.PDO/PDOStatement.cs b/src/PDO/Peachpie.Library.PDO/PDOStatement.cs index 58cdb4fee1..4dffe70d77 100644 --- a/src/PDO/Peachpie.Library.PDO/PDOStatement.cs +++ b/src/PDO/Peachpie.Library.PDO/PDOStatement.cs @@ -321,11 +321,9 @@ public virtual bool closeCursor() /// Returns TRUE on success or FALSE on failure public virtual bool execute(PhpArray input_parameters = null) { - if (Result != null) - { - // reusing command - Connection.ClosePendingReader(); - } + // close previous pending reader + // https://github.com/peachpiecompiler/peachpie/issues/1069 + Connection.ClosePendingReader(); // parameters BindParameters(_cmd.Parameters, input_parameters);