fuel / orm

Fuel PHP Framework - Fuel v1.x ORM
http://fuelphp.com/docs/packages/orm/intro.html
151 stars 95 forks source link

Fix incorrect integer change detection when updating a model #397

Closed crankeye closed 7 years ago

crankeye commented 7 years ago

When a model update is triggered via save() method all fields with the 'data_type' property set to "int" will also get incorrectly marked for update. This means any integer fields will always be updated even if their values have not change.

Changes

Steps to Test

  1. Create an example model with an integer data type
    'some_example_string' => [
            'default' => "",
            'null' => false
        ],
    'some_example_integer' => [
            'data_type' => 'int',
            'default' => 0,
            'null' => false
        ],
$myModel = My_Model::find(1);
$myModel->some_example_string = 'foo';
$myModel->save();

echo DB::last_query();
  1. Validate some_example_integer is not being updated as part of the update query.