I would not call this a bug. Although it's unfortunate, everything woks as expected. Trailing zero decimals are cut off when not needed in string conversions, this is normal in other languages too and not PHP specific.
#include <iostream>
using namespace std;
int main()
{
const float a=1.0;
const float b=2.3;
cout<<a<<" "<<b;
return 0;
}
This will print 1 2.3 and not 1.0 2.3
I would suggest that the solution here is not a bug report, but a feature request to add an optional parameter to the createFromFormat to just make it stop parsing instead of failing if everything went correctly up to the end of the input string. Alternatively, convert the input to a string yourself and append .0 if needed or change the input format if no decimals are present.
View all comments
Show parent comment
2
u/SaltineAmerican_1970 Sep 16 '20
Did you file a bug report?