Skip to content

Handling of negative DECIMAL numbers (mariadb) seems erronous #79

Closed
@dominiquegerber

Description

@dominiquegerber

Please provide the following details.

  • Operating System: Linux
  • PHP Version: 8.0
  • php-mysql-replication Version: 1.0.0
  • *mysql version : 10.3.22-MariaDB-1:10.3.22+maria~bionic-log mariadb.org binary distribution

Steps required to reproduce the problem.

CREATE TABLE test(field DECIMAL(11,4));
INSERT INTO TEST(-57.1234);

Actual Result.

In RowEvent.php line 665:

bcmul(): Argument #1 ($num1) is not well-formed

I have taken a look at the "RowEvent" where the fault occurs. Printing out the offending argument shows that it is indeed malformed : -57.-1234. The negative is applied to both integral and fractional parts, hence the problem. Removing the XOR of the value didn't solve the issue completely, so I "abs" the values and this worked.

I don't know the intricacies of binlogs good enough to be sure that my fix is good —tbh the ABS() seems like a hack to me...— but if it is I can make a pull request for it to be integrated into the project.

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