{"action":"created","issue":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/6788","labels_url":"https://api.github.com/repos/phalcon/cphalcon/issues/6788/labels{/name}","comments_url":"https://api.github.com/repos/phalcon/cphalcon/issues/6788/comments","events_url":"https://api.github.com/repos/phalcon/cphalcon/issues/6788/events","html_url":"https://github.com/phalcon/cphalcon/issues/6788","id":58884140,"number":6788,"title":"[2.0.0] Mvc/Model: Decimal and null fileds cause '0' values in unrelated columns","user":{"login":"meteoblue","id":11191446,"avatar_url":"https://avatars.githubusercontent.com/u/11191446?v=3","gravatar_id":"","url":"https://api.github.com/users/meteoblue","html_url":"https://github.com/meteoblue","followers_url":"https://api.github.com/users/meteoblue/followers","following_url":"https://api.github.com/users/meteoblue/following{/other_user}","gists_url":"https://api.github.com/users/meteoblue/gists{/gist_id}","starred_url":"https://api.github.com/users/meteoblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meteoblue/subscriptions","organizations_url":"https://api.github.com/users/meteoblue/orgs","repos_url":"https://api.github.com/users/meteoblue/repos","events_url":"https://api.github.com/users/meteoblue/events{/privacy}","received_events_url":"https://api.github.com/users/meteoblue/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-25T10:56:46Z","updated_at":"2015-04-13T21:33:11Z","closed_at":null,"body":"Hello,\r\n\r\nI recently upgraded my development system from 1.3.4 to newest 2.0.0. One mvc/model (mysql) now overwrites certain columns to '0' while creating.\r\nI reduced the table structure and code to a minimum. If I change the order of columns the issue does not appear. It requires a null-able, a decimal and a varchar/text/char column.\r\nIf decimal is set, the char column will store '0' in the database instead of 'test'.\r\n\r\nCould someone try to reproduce this issue? Thanks!\r\n\r\nRegards,\r\nPatrick\r\n\r\n```SQL\r\nCREATE TABLE `test` (\r\n  `id` int(11) NOT NULL AUTO_INCREMENT,\r\n  `null_field` int(1) DEFAULT NULL, \r\n  `decimal` decimal(2,1) NOT NULL,\r\n  `char` char(10) NOT NULL,\r\n  PRIMARY KEY (`id`)\r\n) ENGINE=InnoDB  DEFAULT CHARSET=utf8;\r\n```\r\n\r\n```PHP\r\nclass Test extends \\Phalcon\\Mvc\\Model { }\r\n\r\n$t = new Test();\r\n$t->decimal = 3; // has to be set\r\n$t->char = 'test';\r\n$t->save(); // 'char' is stored as '0' in DB, but local scope is still 'test'\r\n$t->refresh(); // after reload, 'char' is now '0'\r\n\r\nif($t->char != 'test') { \r\n    echo 'BUG';\r\n} else {\r\n    echo 'OK';\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/comments/92507501","html_url":"https://github.com/phalcon/cphalcon/issues/6788#issuecomment-92507501","issue_url":"https://api.github.com/repos/phalcon/cphalcon/issues/6788","id":92507501,"user":{"login":"olivier-monaco","id":3101457,"avatar_url":"https://avatars.githubusercontent.com/u/3101457?v=3","gravatar_id":"","url":"https://api.github.com/users/olivier-monaco","html_url":"https://github.com/olivier-monaco","followers_url":"https://api.github.com/users/olivier-monaco/followers","following_url":"https://api.github.com/users/olivier-monaco/following{/other_user}","gists_url":"https://api.github.com/users/olivier-monaco/gists{/gist_id}","starred_url":"https://api.github.com/users/olivier-monaco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olivier-monaco/subscriptions","organizations_url":"https://api.github.com/users/olivier-monaco/orgs","repos_url":"https://api.github.com/users/olivier-monaco/repos","events_url":"https://api.github.com/users/olivier-monaco/events{/privacy}","received_events_url":"https://api.github.com/users/olivier-monaco/received_events","type":"User","site_admin":false},"created_at":"2015-04-13T21:33:11Z","updated_at":"2015-04-13T21:33:11Z","body":"Oups... wrong issue... I'll take a look..."}}