Commit 23fbd86fac6 for php.net
commit 23fbd86fac6a9f57bcd7b55cbb97705d0e4d462d
Author: Marc Bennewitz <marc-mabe@users.noreply.github.com>
Date: Mon Aug 31 18:42:58 2026 +0200
PDO: Migrate maxlen of pdo_column_data from size_t to zend_long (#19144)
* PDO: Migrate maxlen of pdo_column_data from size_t to zend_long
* PDO_ODBC: use displaysize for maxlen and colsize for datalen
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 5731a7e63d3..a414dcb62dd 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -1589,7 +1589,7 @@ PHP_METHOD(PDOStatement, getColumnMeta)
/* add stock items */
col = &stmt->columns[colno];
add_assoc_str(return_value, "name", zend_string_copy(col->name));
- add_assoc_long(return_value, "len", col->maxlen); /* FIXME: unsigned ? */
+ add_assoc_long(return_value, "len", col->maxlen);
add_assoc_long(return_value, "precision", col->precision);
}
/* }}} */
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index 479a1b5436c..62e1f177ebb 100644
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -529,7 +529,7 @@ static inline pdo_dbh_t *php_pdo_dbh_fetch_inner(zend_object *obj) {
/* describes a column */
struct pdo_column_data {
zend_string *name;
- size_t maxlen;
+ zend_long maxlen;
zend_ulong precision;
};
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index 7250860eaf4..1c93a319cca 100644
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -671,7 +671,8 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno)
}
colsize = displaysize;
- col->maxlen = S->cols[colno].datalen = colsize;
+ S->cols[colno].datalen = colsize;
+ col->maxlen = displaysize;
col->name = zend_string_init(S->cols[colno].colname, colnamelen, 0);
S->cols[colno].is_unicode = pdo_odbc_sqltype_is_unicode(S, S->cols[colno].coltype);
diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c
index 25c9e6917e4..891580cbb82 100644
--- a/ext/pdo_sqlite/sqlite_statement.c
+++ b/ext/pdo_sqlite/sqlite_statement.c
@@ -249,7 +249,7 @@ static int pdo_sqlite_stmt_describe(pdo_stmt_t *stmt, int colno)
str = sqlite3_column_name(S->stmt, colno);
stmt->columns[colno].name = zend_string_init(str, strlen(str), 0);
- stmt->columns[colno].maxlen = SIZE_MAX;
+ stmt->columns[colno].maxlen = -1;
stmt->columns[colno].precision = 0;
return 1;