-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pdo_firebird: PDOException has wrong code and message since PHP 8.4 #17383
Comments
I was not feeling well and was late to check. |
The original exception is now chained ( Lines 522 to 526 in ef74ea0
I also think that the following should not be executed if php-src/ext/pdo_firebird/firebird_driver.c Lines 1416 to 1418 in ef74ea0
|
It is my understanding that the change in the message here is a change in the specifications and is not a bug. Regarding the other thing Christophe mentioned, I'll fix it. |
I had a look at this again, and found the culprit. If attaching to the DB fails, we call php-src/ext/pdo_firebird/firebird_driver.c Line 597 in 5f7a9ee
However, https://docwiki.embarcadero.com/InterBase/2020/en/Isc_detach_database() states:
So if we know that an error will be returned, and that we don't need to detach, since attaching failed in the first place, we could apply (in addition to #17632): ext/pdo_firebird/firebird_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c
index 9d7cb20d2c..20ca16eb78 100644
--- a/ext/pdo_firebird/firebird_driver.c
+++ b/ext/pdo_firebird/firebird_driver.c
@@ -594,7 +594,7 @@ static void firebird_handle_closer(pdo_dbh_t *dbh) /* {{{ */
}
H->in_manually_txn = 0;
- if (isc_detach_database(H->isc_status, &H->db)) {
+ if (H->db != NULL && isc_detach_database(H->isc_status, &H->db)) {
php_firebird_error(dbh);
}
That would restore the behavior of PHP-8.3 (and also avoid another Firebird exception to be thrown). |
Sorry for the late reply. https://github.com/php/php-src/actions/runs/13867298424/job/38808811844#step:10:1 edit: |
Oh, in this case the handle is an integer. See also So we should probably only check that |
Great, thanks! |
Description
Since PHP 8.4 in Windows the PDOException has wrong infos.
If PHP connects to a firebird server with an invalid password the call PDOException->getCode() returns 0.
In PHP 8.3.15 getCode() returns 335544472.
I dont know if linux is also affected or if this only happens in windows.
Other PDO is not affected. I checked PDO_Mysql. Code and message is OK.
The following code shows the problem.
Resulted in this output in PHP 8.4.2:
But I expected this output instead like in PHP 8.3.15:
PHP Version
PHP 8.4.2
Operating System
Windows 11 (24H2)
The text was updated successfully, but these errors were encountered: