[php-src] PR #23490: Fixed PDO::CURSOR_SCROLL statements closing a cursor that was never declared
| From: | KentarouTakeda | Date: | Sat, 29 Aug 2026 05:00:46 +0000 |
| Subject: | [php-src] PR #23490: Fixed PDO::CURSOR_SCROLL statements closing a cursor that was never declared | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38185@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23490
Author: KentarouTakeda
The destructor of a statement created with
[PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL]
tries to close the cursor even when it has not been declared. This fixes that.
The attempted close causes an error on the database server, but the destructor discards its result,
so the error cannot be observed by the user. Apart from polluting the server's log, this is
mostly harmless, but when it happens inside a transaction, it causes a strange situation where
subsequent statements fail for a reason that cannot be observed.
The same implementation as the one added here already exists in pgsql_stmt_execute().
This change makes the condition for issuing CLOSE on a cursor consistent within
pgsql_statement.c.