Commit 9b6f83e1bb6 for php.net

commit 9b6f83e1bb61c226bc4dc5a2c35b83ba563f8343
Author: Calvin Buckley <calvinb@php.net>
Date:   Mon Apr 13 12:44:04 2026 -0400

    ext/pdo_odbc: Require non-empty string when building string buffer (#21652)

    A buggy driver could do this and get PDO_ODBC stuck in this loop.
    Require a non-empty string, so an empty one breaks like the SQL_NO_DATA
    case.

    Fixes GH-21534

diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index ea9d5c788f5..c114f721a7a 100644
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -710,7 +710,7 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, zval *result, enum pdo
 					str = zend_string_realloc(str, used + 256, 0);
 					memcpy(ZSTR_VAL(str) + used, buf2, 256);
 					used = used + 255;
-				} else if (rc==SQL_SUCCESS) {
+				} else if (rc == SQL_SUCCESS && C->fetched_len != 0) {
 					str = zend_string_realloc(str, used + C->fetched_len, 0);
 					memcpy(ZSTR_VAL(str) + used, buf2, C->fetched_len);
 					used = used + C->fetched_len;