-
Notifications
You must be signed in to change notification settings - Fork 7.9k
mysql related test cases are failing on big endian system #5380
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1796,7 +1796,7 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_set)(MYSQLND_STMT * const s, | |||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
case STMT_ATTR_CURSOR_TYPE: { | ||||||||||||||||||||||||||||
unsigned int ival = *(unsigned int *) value; | ||||||||||||||||||||||||||||
zend_ulong ival = *(zend_ulong *) value; | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here again, libmysql specifies STMT_ATTR_CURSOR_TYPE (and also STMT_ATTR_PREFETCH_ROWS below) as php-src/ext/mysqli/mysqli_api.c Line 2374 in fd5dc55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nikic Kindly correct me if my understanding is wrong.
Updating diff changes below. Do let me know if any change is required. I have build and tested following changes. index 80c8ca76fa..0bdfc4f48e 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -2375,7 +2375,7 @@ PHP_FUNCTION(mysqli_stmt_attr_get)
{
MY_STMT *stmt;
zval *mysql_stmt;
- zend_ulong value = 0;
+ unsigned long value = 0;
zend_long attr;
int rc;
@@ -2392,7 +2392,7 @@ PHP_FUNCTION(mysqli_stmt_attr_get)
if (attr == STMT_ATTR_UPDATE_MAX_LENGTH)
value = *((my_bool *)&value);
#endif
- RETURN_LONG((zend_ulong)value);
+ RETURN_LONG((unsigned long)value);
}
/* }}} */
diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c
index 9d56f6e032..01ee53e0a8 100644
--- a/ext/mysqlnd/mysqlnd_ps.c
+++ b/ext/mysqlnd/mysqlnd_ps.c
@@ -1796,8 +1796,8 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_set)(MYSQLND_STMT * const s,
break;
}
case STMT_ATTR_CURSOR_TYPE: {
- zend_ulong ival = *(zend_ulong *) value;
- if (ival > (zend_ulong) CURSOR_TYPE_READ_ONLY) {
+ unsigned long ival = *(unsigned long *) value;
+ if (ival > (unsigned long) CURSOR_TYPE_READ_ONLY) {
SET_CLIENT_ERROR(stmt->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented");
DBG_INF("FAIL");
DBG_RETURN(FAIL);
@@ -1806,7 +1806,7 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_set)(MYSQLND_STMT * const s,
break;
}
case STMT_ATTR_PREFETCH_ROWS: {
- unsigned int ival = *(unsigned int *) value;
+ unsigned long ival = *(unsigned long *) value;
if (ival == 0) {
ival = MYSQLND_DEFAULT_PREFETCH_ROWS;
} else if (ival > 1) {
@@ -1845,10 +1845,10 @@ MYSQLND_METHOD(mysqlnd_stmt, attr_get)(const MYSQLND_STMT * const s,
*(zend_bool *) value= stmt->update_max_length;
break;
case STMT_ATTR_CURSOR_TYPE:
- *(zend_ulong *) value= stmt->flags;
+ *(unsigned long *) value= stmt->flags;
break;
case STMT_ATTR_PREFETCH_ROWS:
- *(zend_ulong *) value= stmt->prefetch_rows;
+ *(unsigned long *) value= stmt->prefetch_rows;
break;
default:
DBG_RETURN(FAIL); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those changes look right to me. However, there is one more place that needs to be adjusted: php-src/ext/mysqli/mysqli_api.c Lines 2349 to 2360 in fd5dc55
The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nikic but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but that's fine (can add an explicit cast if you like). The actual values involved here are small, it's just important that the type of the variable whose address we take is correct. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nikic kindly ignore my above comment, I had not covered the implementation for same. I will update earlier said change and raise new commit after testing.Thanks. |
||||||||||||||||||||||||||||
if (ival > (zend_ulong) CURSOR_TYPE_READ_ONLY) { | ||||||||||||||||||||||||||||
SET_CLIENT_ERROR(stmt->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "Not implemented"); | ||||||||||||||||||||||||||||
DBG_INF("FAIL"); | ||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.