{"action":"opened","number":6830,"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/6830","id":93119593,"html_url":"https://github.com/sequelize/sequelize/pull/6830","diff_url":"https://github.com/sequelize/sequelize/pull/6830.diff","patch_url":"https://github.com/sequelize/sequelize/pull/6830.patch","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/6830","number":6830,"state":"open","locked":false,"title":"fix: add type checking for function to escape func","user":{"login":"imatveev","id":10616396,"avatar_url":"https://avatars.githubusercontent.com/u/10616396?v=3","gravatar_id":"","url":"https://api.github.com/users/imatveev","html_url":"https://github.com/imatveev","followers_url":"https://api.github.com/users/imatveev/followers","following_url":"https://api.github.com/users/imatveev/following{/other_user}","gists_url":"https://api.github.com/users/imatveev/gists{/gist_id}","starred_url":"https://api.github.com/users/imatveev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imatveev/subscriptions","organizations_url":"https://api.github.com/users/imatveev/orgs","repos_url":"https://api.github.com/users/imatveev/repos","events_url":"https://api.github.com/users/imatveev/events{/privacy}","received_events_url":"https://api.github.com/users/imatveev/received_events","type":"User","site_admin":false},"body":"### Pull Request check-list\r\n\r\n- [x] Does `npm run test` or `npm run test-DIALECT` pass with this change (including linting)?\r\n- [x] Does your issue contain a link to existing issue (Closes #[issue]) or a description of the issue you are solving?\r\n- [ ] Have you added new tests to prevent regressions?\r\n- [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?\r\n- [ ] Have you added an entry under `Future` in the changelog?\r\n\r\n_NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open._\r\n\r\n### Description of issue\r\nWhen you mistakenly passing an function to one of model fields - **escape** method of sql-string.js interprets it like string and fails with such unhandled error:\r\n```\r\nTypeError: val.replace is not a function\r\n      at Object.SqlString.escape (core/node_modules/sequelize/lib/sql-string.js:61:15)\r\n      at Object.QueryGenerator.escape (core/node_modules/sequelize/lib/dialects/abstract/query-generator.js:978:22)\r\n      at Object.<anonymous> (core/node_modules/sequelize/lib/dialects/abstract/query-generator.js:357:23)\r\n      at Array.map (native)\r\n      at Object.<anonymous> (core/node_modules/sequelize/lib/dialects/abstract/query-generator.js:353:23)\r\n      at Array.forEach (native)\r\n      at Object.QueryGenerator.bulkInsertQuery (core/node_modules/sequelize/lib/dialects/abstract/query-generator.js:351:21)\r\n      at QueryInterface.bulkInsert (core/node_modules/sequelize/lib/query-interface.js:568:33)\r\n      at core/node_modules/sequelize/lib/model.js:2191:34\r\n      at tryCatcher (core/node_modules/bluebird/js/release/util.js:16:23)\r\n      at Promise._settlePromiseFromHandler (core/node_modules/bluebird/js/release/promise.js:510:31)\r\n      at Promise._settlePromise (core/node_modules/bluebird/js/release/promise.js:567:18)\r\n      at Promise._settlePromise0 (core/node_modules/bluebird/js/release/promise.js:612:10)\r\n      at Promise._settlePromises (core/node_modules/bluebird/js/release/promise.js:691:18)\r\n      at Async._drainQueue (core/node_modules/bluebird/js/release/async.js:138:16)\r\n      at Async._drainQueues (core/node_modules/bluebird/js/release/async.js:148:10)\r\n      at Immediate.Async.drainQueues [as _onImmediate] (core/node_modules/bluebird/js/release/async.js:17:14)\r\n```\r\n\r\n### Description of change\r\n\r\nAdded additional checking for type of value in **escape** method.\r\n\r\n","created_at":"2016-11-10T10:01:44Z","updated_at":"2016-11-10T10:01:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/sequelize/sequelize/pulls/6830/commits","review_comments_url":"https://api.github.com/repos/sequelize/sequelize/pulls/6830/comments","review_comment_url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/6830/comments","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/33f55b9c1bcdbb1a5f68ff705529b2a2a47002b4","head":{"label":"imatveev:function-type-check","ref":"function-type-check","sha":"33f55b9c1bcdbb1a5f68ff705529b2a2a47002b4","user":{"login":"imatveev","id":10616396,"avatar_url":"https://avatars.githubusercontent.com/u/10616396?v=3","gravatar_id":"","url":"https://api.github.com/users/imatveev","html_url":"https://github.com/imatveev","followers_url":"https://api.github.com/users/imatveev/followers","following_url":"https://api.github.com/users/imatveev/following{/other_user}","gists_url":"https://api.github.com/users/imatveev/gists{/gist_id}","starred_url":"https://api.github.com/users/imatveev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imatveev/subscriptions","organizations_url":"https://api.github.com/users/imatveev/orgs","repos_url":"https://api.github.com/users/imatveev/repos","events_url":"https://api.github.com/users/imatveev/events{/privacy}","received_events_url":"https://api.github.com/users/imatveev/received_events","type":"User","site_admin":false},"repo":{"id":73366709,"name":"sequelize","full_name":"imatveev/sequelize","owner":{"login":"imatveev","id":10616396,"avatar_url":"https://avatars.githubusercontent.com/u/10616396?v=3","gravatar_id":"","url":"https://api.github.com/users/imatveev","html_url":"https://github.com/imatveev","followers_url":"https://api.github.com/users/imatveev/followers","following_url":"https://api.github.com/users/imatveev/following{/other_user}","gists_url":"https://api.github.com/users/imatveev/gists{/gist_id}","starred_url":"https://api.github.com/users/imatveev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imatveev/subscriptions","organizations_url":"https://api.github.com/users/imatveev/orgs","repos_url":"https://api.github.com/users/imatveev/repos","events_url":"https://api.github.com/users/imatveev/events{/privacy}","received_events_url":"https://api.github.com/users/imatveev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/imatveev/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":true,"url":"https://api.github.com/repos/imatveev/sequelize","forks_url":"https://api.github.com/repos/imatveev/sequelize/forks","keys_url":"https://api.github.com/repos/imatveev/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/imatveev/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/imatveev/sequelize/teams","hooks_url":"https://api.github.com/repos/imatveev/sequelize/hooks","issue_events_url":"https://api.github.com/repos/imatveev/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/imatveev/sequelize/events","assignees_url":"https://api.github.com/repos/imatveev/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/imatveev/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/imatveev/sequelize/tags","blobs_url":"https://api.github.com/repos/imatveev/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/imatveev/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/imatveev/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/imatveev/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/imatveev/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/imatveev/sequelize/languages","stargazers_url":"https://api.github.com/repos/imatveev/sequelize/stargazers","contributors_url":"https://api.github.com/repos/imatveev/sequelize/contributors","subscribers_url":"https://api.github.com/repos/imatveev/sequelize/subscribers","subscription_url":"https://api.github.com/repos/imatveev/sequelize/subscription","commits_url":"https://api.github.com/repos/imatveev/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/imatveev/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/imatveev/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/imatveev/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/imatveev/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/imatveev/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/imatveev/sequelize/merges","archive_url":"https://api.github.com/repos/imatveev/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/imatveev/sequelize/downloads","issues_url":"https://api.github.com/repos/imatveev/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/imatveev/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/imatveev/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/imatveev/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/imatveev/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/imatveev/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/imatveev/sequelize/deployments","created_at":"2016-11-10T09:28:37Z","updated_at":"2016-11-10T09:28:44Z","pushed_at":"2016-11-10T09:34:52Z","git_url":"git://github.com/imatveev/sequelize.git","ssh_url":"git@github.com:imatveev/sequelize.git","clone_url":"https://github.com/imatveev/sequelize.git","svn_url":"https://github.com/imatveev/sequelize","homepage":"http://sequelizejs.com","size":56709,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sequelize:master","ref":"master","sha":"c88bc257647edca87a8a8132fd15e94e6af64177","user":{"login":"sequelize","id":3591786,"avatar_url":"https://avatars.githubusercontent.com/u/3591786?v=3","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"repo":{"id":790359,"name":"sequelize","full_name":"sequelize/sequelize","owner":{"login":"sequelize","id":3591786,"avatar_url":"https://avatars.githubusercontent.com/u/3591786?v=3","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sequelize/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":false,"url":"https://api.github.com/repos/sequelize/sequelize","forks_url":"https://api.github.com/repos/sequelize/sequelize/forks","keys_url":"https://api.github.com/repos/sequelize/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sequelize/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sequelize/sequelize/teams","hooks_url":"https://api.github.com/repos/sequelize/sequelize/hooks","issue_events_url":"https://api.github.com/repos/sequelize/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/sequelize/sequelize/events","assignees_url":"https://api.github.com/repos/sequelize/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/sequelize/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/sequelize/sequelize/tags","blobs_url":"https://api.github.com/repos/sequelize/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sequelize/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sequelize/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/sequelize/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/sequelize/sequelize/languages","stargazers_url":"https://api.github.com/repos/sequelize/sequelize/stargazers","contributors_url":"https://api.github.com/repos/sequelize/sequelize/contributors","subscribers_url":"https://api.github.com/repos/sequelize/sequelize/subscribers","subscription_url":"https://api.github.com/repos/sequelize/sequelize/subscription","commits_url":"https://api.github.com/repos/sequelize/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/sequelize/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/sequelize/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/sequelize/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/sequelize/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/sequelize/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sequelize/sequelize/merges","archive_url":"https://api.github.com/repos/sequelize/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sequelize/sequelize/downloads","issues_url":"https://api.github.com/repos/sequelize/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/sequelize/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/sequelize/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/sequelize/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sequelize/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/sequelize/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/sequelize/sequelize/deployments","created_at":"2010-07-22T07:11:11Z","updated_at":"2016-11-10T08:33:32Z","pushed_at":"2016-11-10T10:01:44Z","git_url":"git://github.com/sequelize/sequelize.git","ssh_url":"git@github.com:sequelize/sequelize.git","clone_url":"https://github.com/sequelize/sequelize.git","svn_url":"https://github.com/sequelize/sequelize","homepage":"http://sequelizejs.com","size":56709,"stargazers_count":7952,"watchers_count":7952,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1593,"mirror_url":null,"open_issues_count":773,"forks":1593,"open_issues":773,"watchers":7952,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/6830"},"html":{"href":"https://github.com/sequelize/sequelize/pull/6830"},"issue":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/6830"},"comments":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/6830/comments"},"review_comments":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/6830/comments"},"review_comment":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/6830/commits"},"statuses":{"href":"https://api.github.com/repos/sequelize/sequelize/statuses/33f55b9c1bcdbb1a5f68ff705529b2a2a47002b4"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":3,"deletions":0,"changed_files":1}}
{"actor":{"display_login":"imatveev"}}