{"action":"closed","issue":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/2587","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/2587/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/2587/comments","events_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/2587/events","html_url":"https://github.com/HaxeFoundation/haxe/issues/2587","id":26571637,"number":2587,"title":"PHP: problem with Array.map and bind","user":{"login":"mockey","id":1682352,"avatar_url":"https://avatars.githubusercontent.com/u/1682352?v=3","gravatar_id":"","url":"https://api.github.com/users/mockey","html_url":"https://github.com/mockey","followers_url":"https://api.github.com/users/mockey/followers","following_url":"https://api.github.com/users/mockey/following{/other_user}","gists_url":"https://api.github.com/users/mockey/gists{/gist_id}","starred_url":"https://api.github.com/users/mockey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mockey/subscriptions","organizations_url":"https://api.github.com/users/mockey/orgs","repos_url":"https://api.github.com/users/mockey/repos","events_url":"https://api.github.com/users/mockey/events{/privacy}","received_events_url":"https://api.github.com/users/mockey/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"Simn","id":634365,"avatar_url":"https://avatars.githubusercontent.com/u/634365?v=3","gravatar_id":"","url":"https://api.github.com/users/Simn","html_url":"https://github.com/Simn","followers_url":"https://api.github.com/users/Simn/followers","following_url":"https://api.github.com/users/Simn/following{/other_user}","gists_url":"https://api.github.com/users/Simn/gists{/gist_id}","starred_url":"https://api.github.com/users/Simn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Simn/subscriptions","organizations_url":"https://api.github.com/users/Simn/orgs","repos_url":"https://api.github.com/users/Simn/repos","events_url":"https://api.github.com/users/Simn/events{/privacy}","received_events_url":"https://api.github.com/users/Simn/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/milestones/5","html_url":"https://github.com/HaxeFoundation/haxe/milestones/3.3","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/milestones/5/labels","id":586975,"number":5,"title":"3.3","description":"","creator":{"login":"ncannasse","id":1022912,"avatar_url":"https://avatars.githubusercontent.com/u/1022912?v=3","gravatar_id":"","url":"https://api.github.com/users/ncannasse","html_url":"https://github.com/ncannasse","followers_url":"https://api.github.com/users/ncannasse/followers","following_url":"https://api.github.com/users/ncannasse/following{/other_user}","gists_url":"https://api.github.com/users/ncannasse/gists{/gist_id}","starred_url":"https://api.github.com/users/ncannasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncannasse/subscriptions","organizations_url":"https://api.github.com/users/ncannasse/orgs","repos_url":"https://api.github.com/users/ncannasse/repos","events_url":"https://api.github.com/users/ncannasse/events{/privacy}","received_events_url":"https://api.github.com/users/ncannasse/received_events","type":"User","site_admin":false},"open_issues":225,"closed_issues":68,"state":"open","created_at":"2014-03-04T14:22:27Z","updated_at":"2015-06-08T15:53:37Z","due_on":"2015-11-01T23:00:00Z","closed_at":null},"comments":28,"created_at":"2014-01-30T02:50:19Z","updated_at":"2015-06-08T15:53:37Z","closed_at":"2015-06-08T15:53:37Z","body":"I try to map an Array<String> with a function and bind like this:\r\n\r\n    thumbs.map(Thumbnail.translateFilename.bind(_, id))\r\n\r\nIn PHP I get:\r\n\r\n    $thumbs->map(Test_1($this, $_t, $clip, $files, $meta, $mf, $thumbs, $vfiles))\r\n\r\nand two functions:\r\n\r\n```\r\nfunction Test_1(&$__hx__this, &$_t, &$clip, &$files, &$meta, &$mf, &$thumbs, &$vfiles) {\r\n\t{\r\n\t\t$a2 = $__hx__this->id;\r\n\t\treturn array(new _hx_lambda(array(&$_t, &$_t2, &$a2, &$clip, &$files, &$meta, &$mf, &$thumbs, &$vfiles), \"Test_2\"), 'execute');\r\n\t}\r\n}\r\nfunction Test2(&$_t, &$a2, &$clip, &$files, &$meta, &$mf, &$thumbs, &$vfiles, $a1) {\r\n\t{\r\n\t\treturn Thumbnail::translateFilename($a1, $a2, null);\r\n\t}\r\n}\r\n```\r\n\r\nThe call with Array.map is inside a larger function with quite a lot a local vars, that's where the long list of vars seems to come from. But the passed variables seem to get mixed up, so the whole thing breaks. In the end a Map is passed ($vfiles a.k.a. $a1) where there should be a string.\r\nSo the PHP-target generates some extra functions, when things get complicated it seems? But why are ALL the local vars from a function passed to these extra functions, even when they are not used in them?\r\nNote that this code used to work a couple of versions (=months) ago. A workaround for now is:\r\n    [for (thumb in thumbs) thumb.translateFilename(id)]\r\n"}}