-1

im having strange bug meaning from time to time my application inserts wrong values in my MySQL table users. I was trying to edit user in many ways but couldn't find where is bug in my code so my question is: Does CakePHP have somekind of access list what fields can be updated in given action

for example : in action action1 fields like created and active can be updated and in any other action thore fields cannot be updated

or is there a tool that can log all mysql updates so i can trace when this bug is occuring?

Viszman
  • 1,378
  • 1
  • 17
  • 47
  • 1
    I don't think cakephp has access list of actions but can you share the method where u edit users, the problem might be there. – Miheretab Alemu Apr 15 '14 at 11:04
  • It's all described in the docs... the [**`$fieldList`**](http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-save-array-data-null-boolean-validate-true-array-fieldlist-array) parameter can be used to restrict the fields to save. ps. please always mention your exact CakePHP version! – ndm Apr 15 '14 at 12:22
  • cake 2.4, i added this 2 week ago and still i get some wrong values – Viszman Apr 15 '14 at 13:27
  • i added in my `user` model `whitelist` w/o fields that are wrong updated and will see what will happen – Viszman Apr 15 '14 at 13:33
  • You can use [DebugKit](https://github.com/cakephp/debug_kit/tree/2.2) to check what queries were executed. – Koen Oct 19 '16 at 14:02

1 Answers1

1

You can print_r posted data just before save() is called to check whether proper data is being passed to Model or in model you can use beforeSave() method to cross check your data again.Created & modified DB columns are auto handled by Cakephp.You can also check Cakephp Query log.

user2064740
  • 44
  • 1
  • 6