You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We upgraded from the deprecated mssql PHP driver to sqlsrv. Our application is written in PHP + Symfony and uses Doctrine to communicate to SQL Server. The platform we are on is Ubuntu 18.04 (after upgrading). Everything works, except for zero decimal/float values. The issue is that the sqlsrv driver omits leading zeros. Values which are in the dabase 0.00 will be fetched as .00.
Actual behavior
sqlsrv driver omits leading zeros in front of decimal/float values.
For example:
In the database: 0.00.
After retrieving the value: .00 in PHP application.
Expected behavior
sqlsrv driver does not omit leading zeros.
Float/decimal values should be returned with leading zeros.
For example:
In the database: 0.00.
After retrieving the value: 0.00 in PHP application.
This is by design and related to a feature request discussed in #415.
New configuration options to format outputs for decimal and numeric for both sqlsrv and pdo_sqlsrv have been recently implemented. Please stay tuned for the release of our next preview to try this out.
@Jeeppler we merged two pull requests (#861 and #873). The changes only applied to decimal and/or numeric types because they are always fetched as strings, unlike floats or integers, which can be fetched as numbers.
PHP Driver version or file name
sqlsrv 5.3.0 PECL
SQL Server version
SQL Server 2016 Standard
Client operating system
Ubuntu LTS 18.04
PHP version
PHP 7.2 - From official Ubuntu 18.04 repositories
Microsoft ODBC Driver version
msodbcsql17/bionic,now 17.2.0.1-1 amd64 (MD5sum: 0a13d93b2af7a0383f93d71448feb0a4)
Problem description
We upgraded from the deprecated
mssql
PHP driver tosqlsrv
. Our application is written in PHP + Symfony and uses Doctrine to communicate to SQL Server. The platform we are on is Ubuntu 18.04 (after upgrading). Everything works, except for zero decimal/float values. The issue is that thesqlsrv
driver omits leading zeros. Values which are in the dabase0.00
will be fetched as.00
.Actual behavior
sqlsrv
driver omits leading zeros in front of decimal/float values.For example:
0.00
..00
in PHP application.Expected behavior
sqlsrv
driver does not omit leading zeros.Float/decimal values should be returned with leading zeros.
For example:
0.00
.0.00
in PHP application.Related
Driver omitting leading zero in decimal
The text was updated successfully, but these errors were encountered: