-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fixed bug #66124 #532
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
Fixed bug #66124 #532
Changes from all commits
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 |
---|---|---|
|
@@ -584,11 +584,24 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar | |
Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX | ||
*/ | ||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_LONG) { | ||
zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv; | ||
/* | ||
Bug #66124. | ||
Copy a new local zval, convert to double on it's own instead of changing copies[i]. | ||
Previous version of declaration is commented | ||
*/ | ||
// zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv; | ||
zval *tmp_data; | ||
MAKE_STD_ZVAL(tmp_data); | ||
*tmp_data = (copies && copies[i])? *copies[i]: *(stmt->param_bind[i].zv); | ||
Z_SET_REFCOUNT_P(tmp_data, 1); | ||
zval_copy_ctor(tmp_data); | ||
|
||
convert_to_double_ex(&tmp_data); | ||
|
||
if (Z_DVAL_P(tmp_data) > LONG_MAX || Z_DVAL_P(tmp_data) < LONG_MIN) { | ||
stmt->send_types_to_server = resend_types_next_time = 1; | ||
} | ||
zval_dtor(tmp_data); | ||
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. You created the zval with
That's the semi-standard approach to performing a cast without touching the zval. The ZVAL_ZVAL is the same as ZVAL_COPY_VALUE+zval_copy_ctor. |
||
} | ||
} | ||
} | ||
|
@@ -630,11 +643,22 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar | |
Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value > LONG_MAX | ||
*/ | ||
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_LONG) { | ||
zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv; | ||
/* | ||
Bug #66124. | ||
Copy a new local zval, convert to double on it's own instead of changing copies[i]. | ||
Previous version of declaration is commented | ||
*/ | ||
// zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv; | ||
|
||
zval *tmp_data; | ||
MAKE_STD_ZVAL(tmp_data); | ||
*tmp_data = (copies && copies[i])? *copies[i]: *(stmt->param_bind[i].zv); | ||
Z_SET_REFCOUNT_P(tmp_data, 1); | ||
zval_copy_ctor(tmp_data); | ||
|
||
convert_to_double_ex(&tmp_data); | ||
if (Z_DVAL_P(tmp_data) > LONG_MAX || Z_DVAL_P(tmp_data) < LONG_MIN) { | ||
convert_to_string_ex(&tmp_data); | ||
convert_to_string_ex(&(copies[i])); | ||
current_type = MYSQL_TYPE_VAR_STRING; | ||
/* | ||
don't change stmt->param_bind[i].type to MYSQL_TYPE_VAR_STRING | ||
|
@@ -643,8 +667,11 @@ mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar | |
We want to preserve the original bind type given by the user. Thus, we do these hacks. | ||
*/ | ||
} else { | ||
convert_to_long_ex(&tmp_data); | ||
convert_to_long_ex(&(copies[i])); | ||
} | ||
|
||
zval_dtor(tmp_data); | ||
|
||
} | ||
} | ||
int2store(*p, current_type); | ||
|
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.
Accessing DVAL after casting to long? That can't be right...
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.
You're right nikic, I put my focus on my problem but forgetting to get everything right, sorry for that.
but the convert to double issue really caused my problem, maybe I should get another temporary zval to make old code working as well
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.
Die Zustellung an folgende Empfänger oder Gruppen verzögert sich:
p.bandow@justepic.infomailto:p.bandow@justepic.info
Betreff: Re: [php-src] Fixed bug #66124 (#532)
Diese Nachricht wurde noch nicht zugestellt. Es wird weiterhin versucht, die Nachricht zuzustellen.
Der Server wird noch 2 Tage, 22 Stunden und 58 Minuten versuchen, die Nachricht zuzustellen. Sie erhalten eine Benachrichtigung, falls die Nachricht bis dahin nicht übermittelt werden konnte.
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.
Die Zustellung an folgende Empfänger oder Gruppen verzögert sich:
p.bandow@justepic.infomailto:p.bandow@justepic.info
Betreff: Re: [php-src] Fixed bug #66124 (#532)
Diese Nachricht wurde noch nicht zugestellt. Es wird weiterhin versucht, die Nachricht zuzustellen.
Der Server wird noch 2 Tage, 22 Stunden und 57 Minuten versuchen, die Nachricht zuzustellen. Sie erhalten eine Benachrichtigung, falls die Nachricht bis dahin nicht übermittelt werden konnte.