Commit 3bacf3fc2e5 for php
commit 3bacf3fc2e5b4e80b13bc11b2bdddac4617b14d3
Author: Joe Nahmias <joe@nahmias.net>
Date: Fri Nov 27 23:46:44 2026 +0800
ext/pdo_odbc: Fall back when SQLDescribeParam returns SQL_UNKNOWN_TYPE (#25569)
Some ODBC drivers, including FreeTDS, report success from
SQLDescribeParam() while returning SQL_UNKNOWN_TYPE. Use the existing PDO
parameter type inference in that case so SQLBindParameter() receives a
concrete type.
Closes #25569
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index 042c4684a88..71d66fefdbf 100644
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -387,7 +387,10 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
}
rc = SQLDescribeParam(S->stmt, (SQLUSMALLINT) param->paramno+1, &sqltype, &precision, &scale, &nullable);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
+ if (
+ (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
+ || sqltype == SQL_UNKNOWN_TYPE
+ ) {
/* MS Access, for instance, doesn't support SQLDescribeParam,
* so we need to guess */
switch (PDO_PARAM_TYPE(param->param_type)) {