@@ -1604,8 +1604,28 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_ROW_BUFFER * row_buffer, zval *
16041604 }
16051605 MYSQLND_INC_CONN_STATISTIC_W_VALUE2 (stats , statistic , 1 , STAT_BYTES_RECEIVED_PURE_DATA_TEXT , len );
16061606 }
1607+ if (fields_metadata [i ].type == MYSQL_TYPE_BIT ) {
1608+ /*
1609+ BIT fields are specially handled. As they come as bit mask, they have
1610+ to be converted to human-readable representation.
1611+ */
1612+ ps_fetch_from_1_to_8_bytes (current_field , & (fields_metadata [i ]), 0 , (const zend_uchar * * ) & p , len );
1613+ /*
1614+ We have advanced in ps_fetch_from_1_to_8_bytes. We should go back because
1615+ later in this function there will be an advancement.
1616+ */
1617+ p -= len ;
1618+ if (Z_TYPE_P (current_field ) == IS_LONG && !as_int_or_float ) {
1619+ /* we are using the text protocol, so convert to string */
1620+ char tmp [22 ];
1621+ const size_t tmp_len = sprintf ((char * )& tmp , ZEND_ULONG_FMT , Z_LVAL_P (current_field ));
1622+ ZVAL_STRINGL (current_field , tmp , tmp_len );
1623+ } else if (Z_TYPE_P (current_field ) == IS_STRING ) {
1624+ /* nothing to do here, as we want a string and ps_fetch_from_1_to_8_bytes() has given us one */
1625+ }
1626+ }
16071627#ifdef MYSQLND_STRING_TO_INT_CONVERSION
1608- if (as_int_or_float && perm_bind .php_type == IS_LONG ) {
1628+ else if (as_int_or_float && perm_bind .php_type == IS_LONG ) {
16091629 zend_uchar save = * (p + len );
16101630 /* We have to make it ASCIIZ temporarily */
16111631 * (p + len ) = '\0' ;
@@ -1649,28 +1669,9 @@ php_mysqlnd_rowp_read_text_protocol_aux(MYSQLND_ROW_BUFFER * row_buffer, zval *
16491669 * (p + len ) = '\0' ;
16501670 ZVAL_DOUBLE (current_field , atof ((char * ) p ));
16511671 * (p + len ) = save ;
1652- } else
1672+ }
16531673#endif /* MYSQLND_STRING_TO_INT_CONVERSION */
1654- if (fields_metadata [i ].type == MYSQL_TYPE_BIT ) {
1655- /*
1656- BIT fields are specially handled. As they come as bit mask, they have
1657- to be converted to human-readable representation.
1658- */
1659- ps_fetch_from_1_to_8_bytes (current_field , & (fields_metadata [i ]), 0 , (const zend_uchar * * ) & p , len );
1660- /*
1661- We have advanced in ps_fetch_from_1_to_8_bytes. We should go back because
1662- later in this function there will be an advancement.
1663- */
1664- p -= len ;
1665- if (Z_TYPE_P (current_field ) == IS_LONG && !as_int_or_float ) {
1666- /* we are using the text protocol, so convert to string */
1667- char tmp [22 ];
1668- const size_t tmp_len = sprintf ((char * )& tmp , ZEND_ULONG_FMT , Z_LVAL_P (current_field ));
1669- ZVAL_STRINGL (current_field , tmp , tmp_len );
1670- } else if (Z_TYPE_P (current_field ) == IS_STRING ) {
1671- /* nothing to do here, as we want a string and ps_fetch_from_1_to_8_bytes() has given us one */
1672- }
1673- } else {
1674+ else {
16741675 ZVAL_STRINGL_FAST (current_field , (char * )p , len );
16751676 }
16761677 p += len ;
0 commit comments