{"action":"created","comment":{"url":"https://api.github.com/repos/livecode/livecode/pulls/comments/66052275","id":66052275,"diff_hunk":"@@ -1369,40 +1369,73 @@ static void MCEngineSendOrCall(MCExecContext& ctxt, MCStringRef p_script, MCObje\n \t}\n \tif ((stat = optr->message(*t_message, t_params, p_is_send, True)) == ES_NOT_HANDLED)\n \t{\n+        // The message was not handled by the target object, so this is\n+        // just a bunch of script to be executed as if it were in a handler\n+        // in the target object (using domess).\n+        \n \t\tMCHandler *t_handler;\n \t\tt_handler = optr -> findhandler(HT_MESSAGE, *t_message);\n \t\tif (t_handler != NULL && t_handler -> isprivate())\n+        {\n \t\t\tctxt . LegacyThrow(EE_SEND_BADEXP, *t_message);\n-\t\telse\n-\t\t{\n-            MCAutoStringRef tptr;\n+            goto cleanup;\n+        }\n \n-\t\t\tif (t_params != NULL)\n-\t\t\t{\n-                MCAutoValueRef t_value;\n-\t\t\t\t/* UNCHECKED */ t_params->eval(ctxt, &t_value);\n-                MCAutoStringRef t_value_string;\n-\t\t\t\tctxt . ConvertToString(*t_value, &t_value_string);\n-                MCStringFormat(&tptr, \"%@ %@\", *t_message, *t_value_string);\n-\t\t\t\t\n-\t\t\t}\n-            else\n-                tptr = MCNameGetString(*t_message);\n+        // The 'split into message and parameters' function above is used\n+        // to ensure that all the parameters are evaluated in the current\n+        // context (not the target). Since domess just takes a string, we\n+        // convert the entire script back into a string with the params\n+        // having been evaluated. This means in particular that variables\n+        // containing arrays will not work here - they will be converted to\n+        // the empty string.\n+        \n+        MCAutoStringRef tptr;\n+        MCAutoListRef t_param_list;\n+        MCListCreateMutable(',', &t_param_list);\n+        MCParameter *t_param_ptr;\n+        t_param_ptr = t_params;\n+        \n+        bool t_has_params;\n+        t_has_params = t_params != nil;\n+        while (t_param_ptr != NULL)\n+        {\n+            MCAutoValueRef t_value;\n+            MCAutoStringRef t_value_string;\n             \n-\t\t\tif ((stat = optr->domess(*tptr)) == ES_ERROR)\n-\t\t\t\tctxt . LegacyThrow(EE_STATEMENT_BADCOMMAND, *t_message);\n-\t\t}\n+            if (!t_param_ptr->eval(ctxt, &t_value) ||\n+                !ctxt . ConvertToString(*t_value, &t_value_string) ||\n+                !MCListAppend(*t_param_list, *t_value_string))\n+                goto cleanup;\n+\n+            t_param_ptr = t_param_ptr -> getnext();\n+        }\n+        \n+        if (t_has_params)\n+        {\n+            MCAutoStringRef t_params_string;\n+            if (!MCListCopyAsString(*t_param_list, &t_params_string) ||\n+                !MCStringFormat(&tptr, \"%@ %@\", *t_message, *t_params_string))","path":"engine/src/exec-engine.cpp","position":66,"original_position":66,"commit_id":"a8f9fc469a690a42c070a0e15af1300d33622a7a","original_commit_id":"a8f9fc469a690a42c070a0e15af1300d33622a7a","user":{"login":"peter-b","id":47528,"avatar_url":"https://avatars.githubusercontent.com/u/47528?v=3","gravatar_id":"","url":"https://api.github.com/users/peter-b","html_url":"https://github.com/peter-b","followers_url":"https://api.github.com/users/peter-b/followers","following_url":"https://api.github.com/users/peter-b/following{/other_user}","gists_url":"https://api.github.com/users/peter-b/gists{/gist_id}","starred_url":"https://api.github.com/users/peter-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peter-b/subscriptions","organizations_url":"https://api.github.com/users/peter-b/orgs","repos_url":"https://api.github.com/users/peter-b/repos","events_url":"https://api.github.com/users/peter-b/events{/privacy}","received_events_url":"https://api.github.com/users/peter-b/received_events","type":"User","site_admin":false},"body":"I believe that `MCStringCreateWithStringsAndSeparator()` would be marginally more efficient here. ;-)","created_at":"2016-06-07T11:20:47Z","updated_at":"2016-06-07T11:20:47Z","html_url":"https://github.com/livecode/livecode/pull/4119#discussion_r66052275","pull_request_url":"https://api.github.com/repos/livecode/livecode/pulls/4119","_links":{"self":{"href":"https://api.github.com/repos/livecode/livecode/pulls/comments/66052275"},"html":{"href":"https://github.com/livecode/livecode/pull/4119#discussion_r66052275"},"pull_request":{"href":"https://api.github.com/repos/livecode/livecode/pulls/4119"}}},"pull_request":{"url":"https://api.github.com/repos/livecode/livecode/pulls/4119","id":72857168,"html_url":"https://github.com/livecode/livecode/pull/4119","diff_url":"https://github.com/livecode/livecode/pull/4119.diff","patch_url":"https://github.com/livecode/livecode/pull/4119.patch","issue_url":"https://api.github.com/repos/livecode/livecode/issues/4119","number":4119,"state":"open","locked":false,"title":"[[ Bug 17800 ]] Ensure all params are included when using send script","user":{"login":"livecodeali","id":3985854,"avatar_url":"https://avatars.githubusercontent.com/u/3985854?v=3","gravatar_id":"","url":"https://api.github.com/users/livecodeali","html_url":"https://github.com/livecodeali","followers_url":"https://api.github.com/users/livecodeali/followers","following_url":"https://api.github.com/users/livecodeali/following{/other_user}","gists_url":"https://api.github.com/users/livecodeali/gists{/gist_id}","starred_url":"https://api.github.com/users/livecodeali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecodeali/subscriptions","organizations_url":"https://api.github.com/users/livecodeali/orgs","repos_url":"https://api.github.com/users/livecodeali/repos","events_url":"https://api.github.com/users/livecodeali/events{/privacy}","received_events_url":"https://api.github.com/users/livecodeali/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-07T11:18:25Z","updated_at":"2016-06-07T11:20:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ffd32a9aaca553165d9a88615e411228af421079","assignee":null,"milestone":{"url":"https://api.github.com/repos/livecode/livecode/milestones/109","html_url":"https://github.com/livecode/livecode/milestones/8.1.0-dp-2","labels_url":"https://api.github.com/repos/livecode/livecode/milestones/109/labels","id":1778952,"number":109,"title":"8.1.0-dp-2","description":null,"creator":{"login":"livecodeali","id":3985854,"avatar_url":"https://avatars.githubusercontent.com/u/3985854?v=3","gravatar_id":"","url":"https://api.github.com/users/livecodeali","html_url":"https://github.com/livecodeali","followers_url":"https://api.github.com/users/livecodeali/followers","following_url":"https://api.github.com/users/livecodeali/following{/other_user}","gists_url":"https://api.github.com/users/livecodeali/gists{/gist_id}","starred_url":"https://api.github.com/users/livecodeali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecodeali/subscriptions","organizations_url":"https://api.github.com/users/livecodeali/orgs","repos_url":"https://api.github.com/users/livecodeali/repos","events_url":"https://api.github.com/users/livecodeali/events{/privacy}","received_events_url":"https://api.github.com/users/livecodeali/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":25,"state":"open","created_at":"2016-05-20T14:38:34Z","updated_at":"2016-06-07T11:18:25Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/livecode/livecode/pulls/4119/commits","review_comments_url":"https://api.github.com/repos/livecode/livecode/pulls/4119/comments","review_comment_url":"https://api.github.com/repos/livecode/livecode/pulls/comments{/number}","comments_url":"https://api.github.com/repos/livecode/livecode/issues/4119/comments","statuses_url":"https://api.github.com/repos/livecode/livecode/statuses/a8f9fc469a690a42c070a0e15af1300d33622a7a","head":{"label":"livecodeali:bugfix-17800","ref":"bugfix-17800","sha":"a8f9fc469a690a42c070a0e15af1300d33622a7a","user":{"login":"livecodeali","id":3985854,"avatar_url":"https://avatars.githubusercontent.com/u/3985854?v=3","gravatar_id":"","url":"https://api.github.com/users/livecodeali","html_url":"https://github.com/livecodeali","followers_url":"https://api.github.com/users/livecodeali/followers","following_url":"https://api.github.com/users/livecodeali/following{/other_user}","gists_url":"https://api.github.com/users/livecodeali/gists{/gist_id}","starred_url":"https://api.github.com/users/livecodeali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecodeali/subscriptions","organizations_url":"https://api.github.com/users/livecodeali/orgs","repos_url":"https://api.github.com/users/livecodeali/repos","events_url":"https://api.github.com/users/livecodeali/events{/privacy}","received_events_url":"https://api.github.com/users/livecodeali/received_events","type":"User","site_admin":false},"repo":{"id":10689153,"name":"livecode","full_name":"livecodeali/livecode","owner":{"login":"livecodeali","id":3985854,"avatar_url":"https://avatars.githubusercontent.com/u/3985854?v=3","gravatar_id":"","url":"https://api.github.com/users/livecodeali","html_url":"https://github.com/livecodeali","followers_url":"https://api.github.com/users/livecodeali/followers","following_url":"https://api.github.com/users/livecodeali/following{/other_user}","gists_url":"https://api.github.com/users/livecodeali/gists{/gist_id}","starred_url":"https://api.github.com/users/livecodeali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecodeali/subscriptions","organizations_url":"https://api.github.com/users/livecodeali/orgs","repos_url":"https://api.github.com/users/livecodeali/repos","events_url":"https://api.github.com/users/livecodeali/events{/privacy}","received_events_url":"https://api.github.com/users/livecodeali/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/livecodeali/livecode","description":"","fork":true,"url":"https://api.github.com/repos/livecodeali/livecode","forks_url":"https://api.github.com/repos/livecodeali/livecode/forks","keys_url":"https://api.github.com/repos/livecodeali/livecode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/livecodeali/livecode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/livecodeali/livecode/teams","hooks_url":"https://api.github.com/repos/livecodeali/livecode/hooks","issue_events_url":"https://api.github.com/repos/livecodeali/livecode/issues/events{/number}","events_url":"https://api.github.com/repos/livecodeali/livecode/events","assignees_url":"https://api.github.com/repos/livecodeali/livecode/assignees{/user}","branches_url":"https://api.github.com/repos/livecodeali/livecode/branches{/branch}","tags_url":"https://api.github.com/repos/livecodeali/livecode/tags","blobs_url":"https://api.github.com/repos/livecodeali/livecode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/livecodeali/livecode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/livecodeali/livecode/git/refs{/sha}","trees_url":"https://api.github.com/repos/livecodeali/livecode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/livecodeali/livecode/statuses/{sha}","languages_url":"https://api.github.com/repos/livecodeali/livecode/languages","stargazers_url":"https://api.github.com/repos/livecodeali/livecode/stargazers","contributors_url":"https://api.github.com/repos/livecodeali/livecode/contributors","subscribers_url":"https://api.github.com/repos/livecodeali/livecode/subscribers","subscription_url":"https://api.github.com/repos/livecodeali/livecode/subscription","commits_url":"https://api.github.com/repos/livecodeali/livecode/commits{/sha}","git_commits_url":"https://api.github.com/repos/livecodeali/livecode/git/commits{/sha}","comments_url":"https://api.github.com/repos/livecodeali/livecode/comments{/number}","issue_comment_url":"https://api.github.com/repos/livecodeali/livecode/issues/comments{/number}","contents_url":"https://api.github.com/repos/livecodeali/livecode/contents/{+path}","compare_url":"https://api.github.com/repos/livecodeali/livecode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/livecodeali/livecode/merges","archive_url":"https://api.github.com/repos/livecodeali/livecode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/livecodeali/livecode/downloads","issues_url":"https://api.github.com/repos/livecodeali/livecode/issues{/number}","pulls_url":"https://api.github.com/repos/livecodeali/livecode/pulls{/number}","milestones_url":"https://api.github.com/repos/livecodeali/livecode/milestones{/number}","notifications_url":"https://api.github.com/repos/livecodeali/livecode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/livecodeali/livecode/labels{/name}","releases_url":"https://api.github.com/repos/livecodeali/livecode/releases{/id}","deployments_url":"https://api.github.com/repos/livecodeali/livecode/deployments","created_at":"2013-06-14T13:10:19Z","updated_at":"2015-05-23T15:45:50Z","pushed_at":"2016-06-07T11:17:08Z","git_url":"git://github.com/livecodeali/livecode.git","ssh_url":"git@github.com:livecodeali/livecode.git","clone_url":"https://github.com/livecodeali/livecode.git","svn_url":"https://github.com/livecodeali/livecode","homepage":null,"size":114283,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"livecode:develop-8.0","ref":"develop-8.0","sha":"7347168f2d4668436d88191119450509ca8f6dca","user":{"login":"livecode","id":3985749,"avatar_url":"https://avatars.githubusercontent.com/u/3985749?v=3","gravatar_id":"","url":"https://api.github.com/users/livecode","html_url":"https://github.com/livecode","followers_url":"https://api.github.com/users/livecode/followers","following_url":"https://api.github.com/users/livecode/following{/other_user}","gists_url":"https://api.github.com/users/livecode/gists{/gist_id}","starred_url":"https://api.github.com/users/livecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecode/subscriptions","organizations_url":"https://api.github.com/users/livecode/orgs","repos_url":"https://api.github.com/users/livecode/repos","events_url":"https://api.github.com/users/livecode/events{/privacy}","received_events_url":"https://api.github.com/users/livecode/received_events","type":"Organization","site_admin":false},"repo":{"id":9334445,"name":"livecode","full_name":"livecode/livecode","owner":{"login":"livecode","id":3985749,"avatar_url":"https://avatars.githubusercontent.com/u/3985749?v=3","gravatar_id":"","url":"https://api.github.com/users/livecode","html_url":"https://github.com/livecode","followers_url":"https://api.github.com/users/livecode/followers","following_url":"https://api.github.com/users/livecode/following{/other_user}","gists_url":"https://api.github.com/users/livecode/gists{/gist_id}","starred_url":"https://api.github.com/users/livecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/livecode/subscriptions","organizations_url":"https://api.github.com/users/livecode/orgs","repos_url":"https://api.github.com/users/livecode/repos","events_url":"https://api.github.com/users/livecode/events{/privacy}","received_events_url":"https://api.github.com/users/livecode/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/livecode/livecode","description":"LiveCode cross-platform development environment (engine)","fork":false,"url":"https://api.github.com/repos/livecode/livecode","forks_url":"https://api.github.com/repos/livecode/livecode/forks","keys_url":"https://api.github.com/repos/livecode/livecode/keys{/key_id}","collaborators_url":"https://api.github.com/repos/livecode/livecode/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/livecode/livecode/teams","hooks_url":"https://api.github.com/repos/livecode/livecode/hooks","issue_events_url":"https://api.github.com/repos/livecode/livecode/issues/events{/number}","events_url":"https://api.github.com/repos/livecode/livecode/events","assignees_url":"https://api.github.com/repos/livecode/livecode/assignees{/user}","branches_url":"https://api.github.com/repos/livecode/livecode/branches{/branch}","tags_url":"https://api.github.com/repos/livecode/livecode/tags","blobs_url":"https://api.github.com/repos/livecode/livecode/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/livecode/livecode/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/livecode/livecode/git/refs{/sha}","trees_url":"https://api.github.com/repos/livecode/livecode/git/trees{/sha}","statuses_url":"https://api.github.com/repos/livecode/livecode/statuses/{sha}","languages_url":"https://api.github.com/repos/livecode/livecode/languages","stargazers_url":"https://api.github.com/repos/livecode/livecode/stargazers","contributors_url":"https://api.github.com/repos/livecode/livecode/contributors","subscribers_url":"https://api.github.com/repos/livecode/livecode/subscribers","subscription_url":"https://api.github.com/repos/livecode/livecode/subscription","commits_url":"https://api.github.com/repos/livecode/livecode/commits{/sha}","git_commits_url":"https://api.github.com/repos/livecode/livecode/git/commits{/sha}","comments_url":"https://api.github.com/repos/livecode/livecode/comments{/number}","issue_comment_url":"https://api.github.com/repos/livecode/livecode/issues/comments{/number}","contents_url":"https://api.github.com/repos/livecode/livecode/contents/{+path}","compare_url":"https://api.github.com/repos/livecode/livecode/compare/{base}...{head}","merges_url":"https://api.github.com/repos/livecode/livecode/merges","archive_url":"https://api.github.com/repos/livecode/livecode/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/livecode/livecode/downloads","issues_url":"https://api.github.com/repos/livecode/livecode/issues{/number}","pulls_url":"https://api.github.com/repos/livecode/livecode/pulls{/number}","milestones_url":"https://api.github.com/repos/livecode/livecode/milestones{/number}","notifications_url":"https://api.github.com/repos/livecode/livecode/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/livecode/livecode/labels{/name}","releases_url":"https://api.github.com/repos/livecode/livecode/releases{/id}","deployments_url":"https://api.github.com/repos/livecode/livecode/deployments","created_at":"2013-04-10T00:15:57Z","updated_at":"2016-06-07T07:38:43Z","pushed_at":"2016-06-07T11:18:25Z","git_url":"git://github.com/livecode/livecode.git","ssh_url":"git@github.com:livecode/livecode.git","clone_url":"https://github.com/livecode/livecode.git","svn_url":"https://github.com/livecode/livecode","homepage":"https://livecode.com/","size":174512,"stargazers_count":119,"watchers_count":119,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":100,"mirror_url":null,"open_issues_count":63,"forks":100,"open_issues":63,"watchers":119,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/livecode/livecode/pulls/4119"},"html":{"href":"https://github.com/livecode/livecode/pull/4119"},"issue":{"href":"https://api.github.com/repos/livecode/livecode/issues/4119"},"comments":{"href":"https://api.github.com/repos/livecode/livecode/issues/4119/comments"},"review_comments":{"href":"https://api.github.com/repos/livecode/livecode/pulls/4119/comments"},"review_comment":{"href":"https://api.github.com/repos/livecode/livecode/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/livecode/livecode/pulls/4119/commits"},"statuses":{"href":"https://api.github.com/repos/livecode/livecode/statuses/a8f9fc469a690a42c070a0e15af1300d33622a7a"}}}}
{"actor":{"display_login":"peter-b"}}