phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.76k stars 1.96k forks source link

[BUG]: Dynamic update model issue #15413

Closed chinalu closed 2 years ago

chinalu commented 3 years ago

Describe the bug Same as #12773, when field type is Decimal or Float

If old value in database is 1.0, then use RawValue to update this field, will reproduce this bug. Because of following logic

case Column::TYPE_DECIMAL:
case Column::TYPE_FLOAT:
    let changed = floatval(snapshotValue) !== floatval(value);
    break;

Because:

floatval(new \Phalcon\Db\RawValue("f+1")) === float(1)

So to reproduce the issue, should be

  1. snapshotValue is 1,
  2. use RawValue to update this field
  3. the field type is DECIMAL or FLOAT
niden commented 2 years ago

Resolved in https://github.com/phalcon/cphalcon/pull/15781