Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  Fix GH-9411: PgSQL large object resource is incorrectly closed
This commit is contained in:
Christoph M. Becker 2022-09-05 17:25:34 +02:00
commit b5cad508fe
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
5 changed files with 95 additions and 5 deletions

View file

@ -134,6 +134,8 @@ static int pgsql_stmt_execute(pdo_stmt_t *stmt)
pdo_pgsql_db_handle *H = S->H;
ExecStatusType status;
bool in_trans = stmt->dbh->methods->in_transaction(stmt->dbh);
/* ensure that we free any previous unfetched results */
if(S->result) {
PQclear(S->result);
@ -252,6 +254,10 @@ stmt_retry:
stmt->row_count = (zend_long)PQntuples(S->result);
}
if (in_trans && !stmt->dbh->methods->in_transaction(stmt->dbh)) {
pdo_pgsql_close_lob_streams(stmt->dbh);
}
return 1;
}