-
Notifications
You must be signed in to change notification settings - Fork 7.9k
PDO: Migrate maxlen of pdo_column_data from size_t to zend_long #19144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -533,7 +533,7 @@ static inline pdo_dbh_object_t *php_pdo_dbh_fetch_object(zend_object *obj) { | |||
/* describes a column */ | |||
struct pdo_column_data { | |||
zend_string *name; | |||
size_t maxlen; | |||
zend_long maxlen; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be more accurate?
zend_long maxlen; | |
ssize_t maxlen; |
Hmm... It seems that in pdo_odbc, a ulong value is passed here (according to the ODBC specification, an unsigned 64-bit integer might be passed). php-src/ext/pdo_odbc/odbc_stmt.c Line 614 in eaf24ba
I suppose such columns are quite rare in practice, but this does introduce a slight possibility of a BC break. One alternative might be to add a flag instead of changing the type to signed. What do you think? @NattyNarwhal |
Already the situation in |
I see |
@SakiTakamachi @NattyNarwhal How should I proceed here? Any suggestions? |
I'd say this looks fine, though you may want to check Gina's suggestion. The issue in PDO_ODBC existed before this; it'd be good to fix that so it presumably uses the signed |
@NattyNarwhal I have updated the PR to set I hope this is fine for this PR as I'm not an ODBC user and my goal is reduce the changes needed in #19079 by splitting out what makes sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense (at least w/ ODBC).
This is returned in PDOStatement::getColumnMeta as
len
documented as "The length of this column. Normally -1 for types other than floating point decimals."Also, It was as
FIXME
already.PQfsize
: returns the space allocated for this column in a database row, in other words the size of the server's internal representation of the data type. (Accordingly, it is not really very useful to clients.) A negative value indicates the data type is variable-length.dbcollen
: The maximum length, in bytes, of the data for the particular column. If the column number is not in range, dbcollen returns -1.XSQLVAR.sqllen
->ISC_SHORT
->signed short
: length of data areaMYSQL_FIELD.length
MYSQLND_FIELD.length
->zend_ulong
: Width of column (create length)unsigned long length
: Width of column (create length)I noticed this during my work of 64bit integers on 32bit arch where it would was failing: https://github.com/php/php-src/actions/runs/16311803646/job/46068812948#step:9:2782