[GIT-PULLS] [php-src] PR #23490: Fixed PDO::CURSOR_SCROLL statements closing a cursor that was never declared
[email protected] (KentarouTakeda)
| Newsgroups | php.git-pulls |
|---|---|
| Message-ID | <[email protected]> |
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`.