{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/36968600","id":36968600,"diff_hunk":"@@ -84,7 +84,11 @@ public function parse($expression, $names)\n             return $expression;\n         }\n \n-        $key = $expression.'//'.implode('-', $names);\n+        $keys = array_map(function($key, $value){\n+            return '{'.\"$key:$value\".'}';\n+        }, array_keys($names), $names);","path":"src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php","position":7,"original_position":7,"commit_id":"e1b8c22d4c747f27dc44e70c5196e1998d47fdbb","original_commit_id":"e1b8c22d4c747f27dc44e70c5196e1998d47fdbb","user":{"login":"stof","id":439401,"avatar_url":"https://avatars.githubusercontent.com/u/439401?v=3","gravatar_id":"","url":"https://api.github.com/users/stof","html_url":"https://github.com/stof","followers_url":"https://api.github.com/users/stof/followers","following_url":"https://api.github.com/users/stof/following{/other_user}","gists_url":"https://api.github.com/users/stof/gists{/gist_id}","starred_url":"https://api.github.com/users/stof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stof/subscriptions","organizations_url":"https://api.github.com/users/stof/orgs","repos_url":"https://api.github.com/users/stof/repos","events_url":"https://api.github.com/users/stof/events{/privacy}","received_events_url":"https://api.github.com/users/stof/received_events","type":"User","site_admin":false},"body":"why not just using ``json_encode($names)`` ?","created_at":"2015-08-13T12:33:43Z","updated_at":"2015-08-13T12:33:43Z","html_url":"https://github.com/symfony/symfony/pull/15537#discussion_r36968600","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/15537","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/36968600"},"html":{"href":"https://github.com/symfony/symfony/pull/15537#discussion_r36968600"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/15537"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/15537","id":42340835,"html_url":"https://github.com/symfony/symfony/pull/15537","diff_url":"https://github.com/symfony/symfony/pull/15537.diff","patch_url":"https://github.com/symfony/symfony/pull/15537.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/15537","number":15537,"state":"open","locked":false,"title":"[expression-language] Cache not Related to Variable Keys","user":{"login":"zerustech","id":417412,"avatar_url":"https://avatars.githubusercontent.com/u/417412?v=3","gravatar_id":"","url":"https://api.github.com/users/zerustech","html_url":"https://github.com/zerustech","followers_url":"https://api.github.com/users/zerustech/followers","following_url":"https://api.github.com/users/zerustech/following{/other_user}","gists_url":"https://api.github.com/users/zerustech/gists{/gist_id}","starred_url":"https://api.github.com/users/zerustech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zerustech/subscriptions","organizations_url":"https://api.github.com/users/zerustech/orgs","repos_url":"https://api.github.com/users/zerustech/repos","events_url":"https://api.github.com/users/zerustech/events{/privacy}","received_events_url":"https://api.github.com/users/zerustech/received_events","type":"User","site_admin":false},"body":"According to the spec, at the compiling time, it's possible to replace\r\nthe default variable names by passing the new names as the associative\r\nkeys in the names array:\r\n\r\n```php\r\n$expr = 'a + b';\r\n$code = $expressionLanguage->compile($expr, array('a', 'B' => 'b'));\r\n// This should return \"($a + $B)\"\r\n```\r\n\r\nHowever, we found this does not work if the expression is evaluated\r\nfirst, because the parsed expression will be cached and variable 'b'\r\nwon't be replaced at the compiling time:\r\n```php\r\n$expr = 'a + b';\r\n$expressionLanguage->evaluate($expr, array('a' => 1, 'b' => 2));\r\n$code = $expression->compile($expr, array('a', 'B' => 'b'));\r\n// This returns \"($a + $b)\" instead of \"($a + $B)\"\r\n```\r\n\r\nThis patch fixed this issue by including variable keys in the cache key.\r\n\r\n| Q             | A\r\n| ------------- | ---\r\n| Bug fix?      | yes\r\n| New feature?  | no\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Fixed tickets | n/a\r\n| License       | MIT\r\n| Doc PR        | n/a","created_at":"2015-08-13T11:40:11Z","updated_at":"2015-08-13T12:33:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b3de02ad4d2f13bf1c7e27871abeb345480b633a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/15537/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/15537/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/15537/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/e1b8c22d4c747f27dc44e70c5196e1998d47fdbb","head":{"label":"zerustech:expression-language-cache-key","ref":"expression-language-cache-key","sha":"e1b8c22d4c747f27dc44e70c5196e1998d47fdbb","user":{"login":"zerustech","id":417412,"avatar_url":"https://avatars.githubusercontent.com/u/417412?v=3","gravatar_id":"","url":"https://api.github.com/users/zerustech","html_url":"https://github.com/zerustech","followers_url":"https://api.github.com/users/zerustech/followers","following_url":"https://api.github.com/users/zerustech/following{/other_user}","gists_url":"https://api.github.com/users/zerustech/gists{/gist_id}","starred_url":"https://api.github.com/users/zerustech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zerustech/subscriptions","organizations_url":"https://api.github.com/users/zerustech/orgs","repos_url":"https://api.github.com/users/zerustech/repos","events_url":"https://api.github.com/users/zerustech/events{/privacy}","received_events_url":"https://api.github.com/users/zerustech/received_events","type":"User","site_admin":false},"repo":{"id":31954893,"name":"symfony","full_name":"zerustech/symfony","owner":{"login":"zerustech","id":417412,"avatar_url":"https://avatars.githubusercontent.com/u/417412?v=3","gravatar_id":"","url":"https://api.github.com/users/zerustech","html_url":"https://github.com/zerustech","followers_url":"https://api.github.com/users/zerustech/followers","following_url":"https://api.github.com/users/zerustech/following{/other_user}","gists_url":"https://api.github.com/users/zerustech/gists{/gist_id}","starred_url":"https://api.github.com/users/zerustech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zerustech/subscriptions","organizations_url":"https://api.github.com/users/zerustech/orgs","repos_url":"https://api.github.com/users/zerustech/repos","events_url":"https://api.github.com/users/zerustech/events{/privacy}","received_events_url":"https://api.github.com/users/zerustech/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zerustech/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/zerustech/symfony","forks_url":"https://api.github.com/repos/zerustech/symfony/forks","keys_url":"https://api.github.com/repos/zerustech/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zerustech/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zerustech/symfony/teams","hooks_url":"https://api.github.com/repos/zerustech/symfony/hooks","issue_events_url":"https://api.github.com/repos/zerustech/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/zerustech/symfony/events","assignees_url":"https://api.github.com/repos/zerustech/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/zerustech/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/zerustech/symfony/tags","blobs_url":"https://api.github.com/repos/zerustech/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zerustech/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zerustech/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/zerustech/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zerustech/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/zerustech/symfony/languages","stargazers_url":"https://api.github.com/repos/zerustech/symfony/stargazers","contributors_url":"https://api.github.com/repos/zerustech/symfony/contributors","subscribers_url":"https://api.github.com/repos/zerustech/symfony/subscribers","subscription_url":"https://api.github.com/repos/zerustech/symfony/subscription","commits_url":"https://api.github.com/repos/zerustech/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/zerustech/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/zerustech/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/zerustech/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/zerustech/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/zerustech/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zerustech/symfony/merges","archive_url":"https://api.github.com/repos/zerustech/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zerustech/symfony/downloads","issues_url":"https://api.github.com/repos/zerustech/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/zerustech/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/zerustech/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/zerustech/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zerustech/symfony/labels{/name}","releases_url":"https://api.github.com/repos/zerustech/symfony/releases{/id}","created_at":"2015-03-10T11:58:31Z","updated_at":"2015-04-18T12:55:17Z","pushed_at":"2015-08-13T11:38:58Z","git_url":"git://github.com/zerustech/symfony.git","ssh_url":"git@github.com:zerustech/symfony.git","clone_url":"https://github.com/zerustech/symfony.git","svn_url":"https://github.com/zerustech/symfony","homepage":"symfony.com","size":58631,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"2.7"}},"base":{"label":"symfony:2.7","ref":"2.7","sha":"f1d588512f529dc12e459301bb357e4345a5e7cf","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"repo":{"id":458058,"name":"symfony","full_name":"symfony/symfony","owner":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony/symfony","description":"The Symfony PHP framework","fork":false,"url":"https://api.github.com/repos/symfony/symfony","forks_url":"https://api.github.com/repos/symfony/symfony/forks","keys_url":"https://api.github.com/repos/symfony/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony/symfony/teams","hooks_url":"https://api.github.com/repos/symfony/symfony/hooks","issue_events_url":"https://api.github.com/repos/symfony/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/symfony/symfony/events","assignees_url":"https://api.github.com/repos/symfony/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/symfony/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/symfony/symfony/tags","blobs_url":"https://api.github.com/repos/symfony/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony/symfony/languages","stargazers_url":"https://api.github.com/repos/symfony/symfony/stargazers","contributors_url":"https://api.github.com/repos/symfony/symfony/contributors","subscribers_url":"https://api.github.com/repos/symfony/symfony/subscribers","subscription_url":"https://api.github.com/repos/symfony/symfony/subscription","commits_url":"https://api.github.com/repos/symfony/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/symfony/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/symfony/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony/symfony/merges","archive_url":"https://api.github.com/repos/symfony/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony/symfony/downloads","issues_url":"https://api.github.com/repos/symfony/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/symfony/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony/symfony/labels{/name}","releases_url":"https://api.github.com/repos/symfony/symfony/releases{/id}","created_at":"2010-01-04T14:21:21Z","updated_at":"2015-08-13T11:10:31Z","pushed_at":"2015-08-13T12:17:25Z","git_url":"git://github.com/symfony/symfony.git","ssh_url":"git@github.com:symfony/symfony.git","clone_url":"https://github.com/symfony/symfony.git","svn_url":"https://github.com/symfony/symfony","homepage":"symfony.com","size":237134,"stargazers_count":10618,"watchers_count":10618,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":4208,"mirror_url":null,"open_issues_count":909,"forks":4208,"open_issues":909,"watchers":10618,"default_branch":"2.8"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/15537"},"html":{"href":"https://github.com/symfony/symfony/pull/15537"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/15537"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/15537/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/15537/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/15537/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/e1b8c22d4c747f27dc44e70c5196e1998d47fdbb"}}}}