If the ZEROFILL flag is set for a field, do not convert it into
an integer (text protocol) or convert it explicitly into a padded
string (binary protocol).
This commit is contained in:
Nikita Popov 2021-03-02 10:58:35 +01:00
parent c28751c69c
commit 3a867b9827
5 changed files with 36 additions and 3 deletions

View file

@ -1600,7 +1600,8 @@ php_mysqlnd_rowp_read_text_protocol(MYSQLND_ROW_BUFFER * row_buffer, zval * fiel
} 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 */
}
} else if (as_int_or_float && perm_bind.php_type == IS_LONG) {
} else if (as_int_or_float && perm_bind.php_type == IS_LONG
&& !(fields_metadata[i].flags & ZEROFILL_FLAG)) {
zend_uchar save = *(p + len);
/* We have to make it ASCIIZ temporarily */
*(p + len) = '\0';