com php-src: Merge branch 'PHP-8.0': ext/mysqlnd/mysqlnd_wire protocol.c
| From: | Nikita Popov | Date: | Wed, 16 Dec 2020 09:54:36 +0000 |
| Subject: | com php-src: Merge branch 'PHP-8.0': ext/mysqlnd/mysqlnd_wire protocol.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-114479@lists.php.net to get a copy of this message | ||
Commit: 1c29db19d46122066be24d065924fd7052a5b5ee
Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 16 Dec 2020 10:54:36 +0100
Parents: 8bd5310a1e13e169d2d39f0a6701694ef6a5daf0 1a66d64717d08e9b7f7c9328be673018cfe28c11
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1c29db19d46122066be24d065924fd7052a5b5ee
Log:
Merge branch 'PHP-8.0'
* PHP-8.0:
Fixed bug #67983
Bugs:
https://bugs.php.net/67983
Changed paths:
MM ext/mysqlnd/mysqlnd_wireprotocol.c
Diff:
diff --cc ext/mysqlnd/mysqlnd_wireprotocol.c
index d33e266b6dc,1fc2941e663..a0ba748a6cb
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@@ -1592,7 -1604,28 +1592,26 @@@ php_mysqlnd_rowp_read_text_protocol_aux
}
MYSQLND_INC_CONN_STATISTIC_W_VALUE2(stats, statistic, 1, STAT_BYTES_RECEIVED_PURE_DATA_TEXT,
len);
}
- if (as_int_or_float && perm_bind.php_type == IS_LONG) {
+ if (fields_metadata[i].type == MYSQL_TYPE_BIT) {
+ /*
+ BIT fields are specially handled. As they come as bit mask, they have
+ to be converted to human-readable representation.
+ */
+ ps_fetch_from_1_to_8_bytes(current_field, &(fields_metadata[i]), 0, (const zend_uchar **)
&p, len);
+ /*
+ We have advanced in ps_fetch_from_1_to_8_bytes. We should go back because
+ later in this function there will be an advancement.
+ */
+ p -= len;
+ if (Z_TYPE_P(current_field) == IS_LONG && !as_int_or_float) {
+ /* we are using the text protocol, so convert to string */
+ char tmp[22];
+ const size_t tmp_len = sprintf((char *)&tmp, ZEND_ULONG_FMT, Z_LVAL_P(current_field));
+ ZVAL_STRINGL(current_field, tmp, tmp_len);
+ } else if (Z_TYPE_P(current_field) == IS_STRING) {
+ /* nothing to do here, as we want a string and ps_fetch_from_1_to_8_bytes() has given us one
*/
+ }
- }
-#ifdef MYSQLND_STRING_TO_INT_CONVERSION
- else if (as_int_or_float && perm_bind.php_type == IS_LONG) {
++ } else if (as_int_or_float && perm_bind.php_type == IS_LONG) {
zend_uchar save = *(p + len);
/* We have to make it ASCIIZ temporarily */
*(p + len) = '\0';
@@@ -1636,26 -1669,9 +1655,7 @@@
*(p + len) = '\0';
ZVAL_DOUBLE(current_field, atof((char *) p));
*(p + len) = save;
- } else if (fields_metadata[i].type == MYSQL_TYPE_BIT) {
- /*
- BIT fields are specially handled. As they come as bit mask, they have
- to be converted to human-readable representation.
- */
- ps_fetch_from_1_to_8_bytes(current_field, &(fields_metadata[i]), 0, (const zend_uchar **)
&p, len);
- /*
- We have advanced in ps_fetch_from_1_to_8_bytes. We should go back because
- later in this function there will be an advancement.
- */
- p -= len;
- if (Z_TYPE_P(current_field) == IS_LONG && !as_int_or_float) {
- /* we are using the text protocol, so convert to string */
- char tmp[22];
- const size_t tmp_len = sprintf((char *)&tmp, ZEND_ULONG_FMT, Z_LVAL_P(current_field));
- ZVAL_STRINGL(current_field, tmp, tmp_len);
- } else if (Z_TYPE_P(current_field) == IS_STRING) {
- /* nothing to do here, as we want a string and ps_fetch_from_1_to_8_bytes() has given us one
*/
- }
- }
-#endif /* MYSQLND_STRING_TO_INT_CONVERSION */
- else {
+ } else {
ZVAL_STRINGL_FAST(current_field, (char *)p, len);
}
p += len;