Skip to content

Decoding of DECIMALS adds non significant trailing zeroes #81

Open
@dominiquegerber

Description

@dominiquegerber

Please provide the following details.

  • Operating System: Linux
  • PHP Version: 7.4
  • php-mysql-replication Version: 7.0
  • mysql version 10.3.22-MariaDB-1:10.3.22+maria~bionic-log

Steps required to reproduce the problem (take from the unit tests)

CREATE TABLE test (test DECIMAL(20,10));
INSERT INTO test VALUES(-42000.123456);

Expected Result.

'-42000.123456'

Actual Result.

'-42000.1234560000'

Why this is a problem

Mathematically speaking, both results are valid. However decimals are represented using strings in the lib (bcmath). Hence, when tested for equality, '-42000.123456' is not the same as '-42000.1234560000'. Greater/Lower comparison do work, but not strict equality. The unit tests enforce the presence of these trailing zeroes, which to me should not be.

I can do a pull request to fix this if you agree with me that this is an issue. Not a big one, but still :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions