Skip to content

Commit 06037f8

Browse files
committed
Fix invalid Firebird isolation level proceeding with the connection
pdo_firebird_handle_factory() raised a ValueError for an out-of-range TRANSACTION_ISOLATION_LEVEL but only set ret = 0; zend_value_error() queues the exception without aborting, so control fell through into the isc_attach_database() block, opened the connection and overwrote ret with 1. The constructor then returned success with a pending ValueError and a live handle whose isolation level was never selected. Break out of the attach block when an exception is pending and skip the trailing fb_interpret() error so the ValueError is the sole result; the existing !ret cleanup closes the unused handle. Closes GH-22430
1 parent 5af5614 commit 06037f8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ext/pdo_firebird/firebird_driver.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,6 +1410,10 @@ static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /*
14101410
char const *dpb_values[] = { dbh->username, dbh->password, vars[1].optval, vars[2].optval };
14111411
char dpb_buffer[256] = { isc_dpb_version1 }, *dpb;
14121412

1413+
if (EG(exception)) {
1414+
break;
1415+
}
1416+
14131417
dpb = dpb_buffer + 1;
14141418

14151419
/* loop through all the provided arguments and set dpb fields accordingly */
@@ -1446,7 +1450,7 @@ static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /*
14461450
}
14471451
}
14481452

1449-
if (!dbh->methods) {
1453+
if (!dbh->methods && !EG(exception)) {
14501454
char errmsg[512];
14511455
const ISC_STATUS *s = H->isc_status;
14521456
fb_interpret(errmsg, sizeof(errmsg),&s);

0 commit comments

Comments
 (0)