Skip to content

Commit f21f7c7

Browse files
committed
Fix Db2 and non-ODBC transports with PHP 8.4
The fix for ODBC regressed Db2 support with an overzealous check at the generic Toolkit level.
1 parent f2f1180 commit f21f7c7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ToolkitApi/Toolkit.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,10 @@ public function __construct($databaseNameOrResource, $userOrI5NamingFlag = '0',
285285
$this->debugLog("Created a new db connection in $durationCreate seconds.");
286286
}
287287

288-
if ((version_compare(PHP_VERSION, '8.4.0', '<') && !is_resource($conn)) ||
289-
(version_compare(PHP_VERSION, '8.4.0', '>=') && !($conn instanceof \Odbc\Connection))) {
288+
// Just check if the transport connection isn't false/null.
289+
// Stricter checks for resource vs. object should be done at
290+
// transport level due to version variance.
291+
if (!$conn) {
290292
// Note: SQLState 08001 (with or without SQLCODE=-30082) usually means invalid user or password. This is true for DB2 and ODBC.
291293
$sqlState = $transport->getErrorCode();
292294
$this->error = $transport->getErrorMsg();

0 commit comments

Comments
 (0)