Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/scripts/windows/test_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@ if "%PLATFORM%" == "x64" (
curl -sLo Firebird.zip %PHP_FIREBIRD_DOWNLOAD_URL%
7z x -oC:\Firebird Firebird.zip
set PDO_FIREBIRD_TEST_DATABASE=C:\test.fdb
set PDO_FIREBIRD_TEST_DSN=firebird:dbname=%PDO_FIREBIRD_TEST_DATABASE%
set PDO_FIREBIRD_TEST_DSN=firebird:dbname=127.0.0.1:%PDO_FIREBIRD_TEST_DATABASE%
set PDO_FIREBIRD_TEST_USER=SYSDBA
set PDO_FIREBIRD_TEST_PASS=phpfi
echo create user %PDO_FIREBIRD_TEST_USER% password '%PDO_FIREBIRD_TEST_PASS%';> C:\Firebird\create_user.sql
echo commit;>> C:\Firebird\create_user.sql
echo create database '%PDO_FIREBIRD_TEST_DATABASE%' user '%PDO_FIREBIRD_TEST_USER%' password '%PDO_FIREBIRD_TEST_PASS%';> C:\Firebird\setup.sql
C:\Firebird\instsvc.exe install -n TestInstance
C:\Firebird\isql -q -i C:\Firebird\setup.sql
C:\Firebird\isql -q -i C:\Firebird\create_user.sql -user sysdba %PDO_FIREBIRD_TEST_DATABASE%
C:\Firebird\instsvc.exe start -n TestInstance
if %errorlevel% neq 0 exit /b 3
path C:\Firebird;%PATH%
Expand Down
3 changes: 2 additions & 1 deletion ext/pdo_firebird/firebird_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,8 @@ static void firebird_handle_closer(pdo_dbh_t *dbh) /* {{{ */
}
H->in_manually_txn = 0;

if (isc_detach_database(H->isc_status, &H->db)) {
/* isc_detach_database returns 0 on success, 1 on failure. */
if (H->db && isc_detach_database(H->isc_status, &H->db)) {
php_firebird_error(dbh);
}

Expand Down
38 changes: 38 additions & 0 deletions ext/pdo_firebird/tests/gh17383.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--TEST--
GH-17383 (PDOException has wrong code and message since PHP 8.4)
--EXTENSIONS--
pdo_firebird
--SKIPIF--
<?php require('skipif.inc'); ?>
--XLEAK--
A bug in firebird causes a memory leak when calling `isc_attach_database()`.
See https://github.com/FirebirdSQL/firebird/issues/7849
--FILE--
<?php

require("testdb.inc");
unset($dbh);

foreach ([
['firebird:dbname=invalid_host:db', PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS],
[PDO_FIREBIRD_TEST_DSN, 'invalid_user', PDO_FIREBIRD_TEST_PASS],
[PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, 'invalid_pass'],
] as [$dsn, $user, $pass]) {
try {
$dbh = new PDO($dsn, $user, $pass);
} catch (PDOException $e) {
echo 'PDOException code: ' . $e->getCode() . "\n";
echo 'PDOException message: ' . $e->getMessage() . "\n";
echo "\n";
}
}
?>
--EXPECT--
PDOException code: 335544721
PDOException message: SQLSTATE[HY000] [335544721] Unable to complete network request to host "invalid_host".

PDOException code: 335544472
PDOException message: SQLSTATE[HY000] [335544472] Your user name and password are not defined. Ask your database administrator to set up a Firebird login.

PDOException code: 335544472
PDOException message: SQLSTATE[HY000] [335544472] Your user name and password are not defined. Ask your database administrator to set up a Firebird login.