{"action":"created","comment":{"url":"https://api.github.com/repos/twigphp/Twig/pulls/comments/87374670","pull_request_review_id":7988633,"id":87374670,"diff_hunk":"@@ -607,15 +618,33 @@ protected function getAttribute($object, $item, array $arguments = array(), $typ\n             $this->env->getExtension('Twig_Extension_Sandbox')->checkMethodAllowed($object, $method);\n         }\n \n-        // Some objects throw exceptions when they have __call, and the method we try\n-        // to call is not supported. If ignoreStrictCheck is true, we should return null.\n-        try {\n-            $ret = call_user_func_array(array($object, $method), $arguments);\n-        } catch (BadMethodCallException $e) {\n-            if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) {\n-                return;\n+        if ($call) {\n+            // Some objects throw exceptions when they have __call, and the method we try\n+            // to call is not supported. If ignoreStrictCheck is true, we should return null.\n+            try {\n+                $ret = $object->__call($method, $arguments);\n+            } catch (BadMethodCallException $e) {\n+                if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {\n+                    return;\n+                }\n+                throw $e;\n             }\n-            throw $e;\n+        } elseif ($a = $arguments) {\n+            switch (false) {\n+                case isset($a[1]): $ret = $object->$method($a[0]); break;","path":"lib/Twig/Template.php","position":100,"original_position":100,"commit_id":"d0e59245f6638afb423f093863aef86f57db6251","original_commit_id":"d0e59245f6638afb423f093863aef86f57db6251","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":"what if the argument is provided as ``null`` ? This will break things. You should switch on ``count($arguments)`` instead","created_at":"2016-11-10T11:17:18Z","updated_at":"2016-11-10T11:24:43Z","html_url":"https://github.com/twigphp/Twig/pull/2228#discussion_r87374670","pull_request_url":"https://api.github.com/repos/twigphp/Twig/pulls/2228","_links":{"self":{"href":"https://api.github.com/repos/twigphp/Twig/pulls/comments/87374670"},"html":{"href":"https://github.com/twigphp/Twig/pull/2228#discussion_r87374670"},"pull_request":{"href":"https://api.github.com/repos/twigphp/Twig/pulls/2228"}}},"pull_request":{"url":"https://api.github.com/repos/twigphp/Twig/pulls/2228","id":93128889,"html_url":"https://github.com/twigphp/Twig/pull/2228","diff_url":"https://github.com/twigphp/Twig/pull/2228.diff","patch_url":"https://github.com/twigphp/Twig/pull/2228.patch","issue_url":"https://api.github.com/repos/twigphp/Twig/issues/2228","number":2228,"state":"open","locked":false,"title":"Enhance perf of Template::getAttribute()","user":{"login":"nicolas-grekas","id":243674,"avatar_url":"https://avatars.githubusercontent.com/u/243674?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas-grekas","html_url":"https://github.com/nicolas-grekas","followers_url":"https://api.github.com/users/nicolas-grekas/followers","following_url":"https://api.github.com/users/nicolas-grekas/following{/other_user}","gists_url":"https://api.github.com/users/nicolas-grekas/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas-grekas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas-grekas/subscriptions","organizations_url":"https://api.github.com/users/nicolas-grekas/orgs","repos_url":"https://api.github.com/users/nicolas-grekas/repos","events_url":"https://api.github.com/users/nicolas-grekas/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas-grekas/received_events","type":"User","site_admin":false},"body":"Note that this is unproved statement for now :)\r\nIf someone has a benchmark and want to try, please do (and share results)","created_at":"2016-11-10T11:00:14Z","updated_at":"2016-11-10T11:24:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60180ad2e1681ffd940121230ceab37f3b07e5b3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/twigphp/Twig/pulls/2228/commits","review_comments_url":"https://api.github.com/repos/twigphp/Twig/pulls/2228/comments","review_comment_url":"https://api.github.com/repos/twigphp/Twig/pulls/comments{/number}","comments_url":"https://api.github.com/repos/twigphp/Twig/issues/2228/comments","statuses_url":"https://api.github.com/repos/twigphp/Twig/statuses/d0e59245f6638afb423f093863aef86f57db6251","head":{"label":"nicolas-grekas:attributes-perf","ref":"attributes-perf","sha":"d0e59245f6638afb423f093863aef86f57db6251","user":{"login":"nicolas-grekas","id":243674,"avatar_url":"https://avatars.githubusercontent.com/u/243674?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas-grekas","html_url":"https://github.com/nicolas-grekas","followers_url":"https://api.github.com/users/nicolas-grekas/followers","following_url":"https://api.github.com/users/nicolas-grekas/following{/other_user}","gists_url":"https://api.github.com/users/nicolas-grekas/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas-grekas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas-grekas/subscriptions","organizations_url":"https://api.github.com/users/nicolas-grekas/orgs","repos_url":"https://api.github.com/users/nicolas-grekas/repos","events_url":"https://api.github.com/users/nicolas-grekas/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas-grekas/received_events","type":"User","site_admin":false},"repo":{"id":42297220,"name":"Twig","full_name":"nicolas-grekas/Twig","owner":{"login":"nicolas-grekas","id":243674,"avatar_url":"https://avatars.githubusercontent.com/u/243674?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas-grekas","html_url":"https://github.com/nicolas-grekas","followers_url":"https://api.github.com/users/nicolas-grekas/followers","following_url":"https://api.github.com/users/nicolas-grekas/following{/other_user}","gists_url":"https://api.github.com/users/nicolas-grekas/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas-grekas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas-grekas/subscriptions","organizations_url":"https://api.github.com/users/nicolas-grekas/orgs","repos_url":"https://api.github.com/users/nicolas-grekas/repos","events_url":"https://api.github.com/users/nicolas-grekas/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas-grekas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nicolas-grekas/Twig","description":"Twig, the flexible, fast, and secure template language for PHP","fork":true,"url":"https://api.github.com/repos/nicolas-grekas/Twig","forks_url":"https://api.github.com/repos/nicolas-grekas/Twig/forks","keys_url":"https://api.github.com/repos/nicolas-grekas/Twig/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nicolas-grekas/Twig/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nicolas-grekas/Twig/teams","hooks_url":"https://api.github.com/repos/nicolas-grekas/Twig/hooks","issue_events_url":"https://api.github.com/repos/nicolas-grekas/Twig/issues/events{/number}","events_url":"https://api.github.com/repos/nicolas-grekas/Twig/events","assignees_url":"https://api.github.com/repos/nicolas-grekas/Twig/assignees{/user}","branches_url":"https://api.github.com/repos/nicolas-grekas/Twig/branches{/branch}","tags_url":"https://api.github.com/repos/nicolas-grekas/Twig/tags","blobs_url":"https://api.github.com/repos/nicolas-grekas/Twig/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nicolas-grekas/Twig/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nicolas-grekas/Twig/git/refs{/sha}","trees_url":"https://api.github.com/repos/nicolas-grekas/Twig/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nicolas-grekas/Twig/statuses/{sha}","languages_url":"https://api.github.com/repos/nicolas-grekas/Twig/languages","stargazers_url":"https://api.github.com/repos/nicolas-grekas/Twig/stargazers","contributors_url":"https://api.github.com/repos/nicolas-grekas/Twig/contributors","subscribers_url":"https://api.github.com/repos/nicolas-grekas/Twig/subscribers","subscription_url":"https://api.github.com/repos/nicolas-grekas/Twig/subscription","commits_url":"https://api.github.com/repos/nicolas-grekas/Twig/commits{/sha}","git_commits_url":"https://api.github.com/repos/nicolas-grekas/Twig/git/commits{/sha}","comments_url":"https://api.github.com/repos/nicolas-grekas/Twig/comments{/number}","issue_comment_url":"https://api.github.com/repos/nicolas-grekas/Twig/issues/comments{/number}","contents_url":"https://api.github.com/repos/nicolas-grekas/Twig/contents/{+path}","compare_url":"https://api.github.com/repos/nicolas-grekas/Twig/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nicolas-grekas/Twig/merges","archive_url":"https://api.github.com/repos/nicolas-grekas/Twig/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nicolas-grekas/Twig/downloads","issues_url":"https://api.github.com/repos/nicolas-grekas/Twig/issues{/number}","pulls_url":"https://api.github.com/repos/nicolas-grekas/Twig/pulls{/number}","milestones_url":"https://api.github.com/repos/nicolas-grekas/Twig/milestones{/number}","notifications_url":"https://api.github.com/repos/nicolas-grekas/Twig/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nicolas-grekas/Twig/labels{/name}","releases_url":"https://api.github.com/repos/nicolas-grekas/Twig/releases{/id}","deployments_url":"https://api.github.com/repos/nicolas-grekas/Twig/deployments","created_at":"2015-09-11T08:36:25Z","updated_at":"2015-09-11T08:36:26Z","pushed_at":"2016-11-10T10:45:11Z","git_url":"git://github.com/nicolas-grekas/Twig.git","ssh_url":"git@github.com:nicolas-grekas/Twig.git","clone_url":"https://github.com/nicolas-grekas/Twig.git","svn_url":"https://github.com/nicolas-grekas/Twig","homepage":"http://twig.sensiolabs.org/","size":3653,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"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":"1.x"}},"base":{"label":"twigphp:1.x","ref":"1.x","sha":"dc3533c3479c9ffd4ebcdf3dd8f0cdd24a5a19ff","user":{"login":"twigphp","id":5296178,"avatar_url":"https://avatars.githubusercontent.com/u/5296178?v=3","gravatar_id":"","url":"https://api.github.com/users/twigphp","html_url":"https://github.com/twigphp","followers_url":"https://api.github.com/users/twigphp/followers","following_url":"https://api.github.com/users/twigphp/following{/other_user}","gists_url":"https://api.github.com/users/twigphp/gists{/gist_id}","starred_url":"https://api.github.com/users/twigphp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twigphp/subscriptions","organizations_url":"https://api.github.com/users/twigphp/orgs","repos_url":"https://api.github.com/users/twigphp/repos","events_url":"https://api.github.com/users/twigphp/events{/privacy}","received_events_url":"https://api.github.com/users/twigphp/received_events","type":"Organization","site_admin":false},"repo":{"id":330275,"name":"Twig","full_name":"twigphp/Twig","owner":{"login":"twigphp","id":5296178,"avatar_url":"https://avatars.githubusercontent.com/u/5296178?v=3","gravatar_id":"","url":"https://api.github.com/users/twigphp","html_url":"https://github.com/twigphp","followers_url":"https://api.github.com/users/twigphp/followers","following_url":"https://api.github.com/users/twigphp/following{/other_user}","gists_url":"https://api.github.com/users/twigphp/gists{/gist_id}","starred_url":"https://api.github.com/users/twigphp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twigphp/subscriptions","organizations_url":"https://api.github.com/users/twigphp/orgs","repos_url":"https://api.github.com/users/twigphp/repos","events_url":"https://api.github.com/users/twigphp/events{/privacy}","received_events_url":"https://api.github.com/users/twigphp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/twigphp/Twig","description":"Twig, the flexible, fast, and secure template language for PHP","fork":false,"url":"https://api.github.com/repos/twigphp/Twig","forks_url":"https://api.github.com/repos/twigphp/Twig/forks","keys_url":"https://api.github.com/repos/twigphp/Twig/keys{/key_id}","collaborators_url":"https://api.github.com/repos/twigphp/Twig/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/twigphp/Twig/teams","hooks_url":"https://api.github.com/repos/twigphp/Twig/hooks","issue_events_url":"https://api.github.com/repos/twigphp/Twig/issues/events{/number}","events_url":"https://api.github.com/repos/twigphp/Twig/events","assignees_url":"https://api.github.com/repos/twigphp/Twig/assignees{/user}","branches_url":"https://api.github.com/repos/twigphp/Twig/branches{/branch}","tags_url":"https://api.github.com/repos/twigphp/Twig/tags","blobs_url":"https://api.github.com/repos/twigphp/Twig/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/twigphp/Twig/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/twigphp/Twig/git/refs{/sha}","trees_url":"https://api.github.com/repos/twigphp/Twig/git/trees{/sha}","statuses_url":"https://api.github.com/repos/twigphp/Twig/statuses/{sha}","languages_url":"https://api.github.com/repos/twigphp/Twig/languages","stargazers_url":"https://api.github.com/repos/twigphp/Twig/stargazers","contributors_url":"https://api.github.com/repos/twigphp/Twig/contributors","subscribers_url":"https://api.github.com/repos/twigphp/Twig/subscribers","subscription_url":"https://api.github.com/repos/twigphp/Twig/subscription","commits_url":"https://api.github.com/repos/twigphp/Twig/commits{/sha}","git_commits_url":"https://api.github.com/repos/twigphp/Twig/git/commits{/sha}","comments_url":"https://api.github.com/repos/twigphp/Twig/comments{/number}","issue_comment_url":"https://api.github.com/repos/twigphp/Twig/issues/comments{/number}","contents_url":"https://api.github.com/repos/twigphp/Twig/contents/{+path}","compare_url":"https://api.github.com/repos/twigphp/Twig/compare/{base}...{head}","merges_url":"https://api.github.com/repos/twigphp/Twig/merges","archive_url":"https://api.github.com/repos/twigphp/Twig/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/twigphp/Twig/downloads","issues_url":"https://api.github.com/repos/twigphp/Twig/issues{/number}","pulls_url":"https://api.github.com/repos/twigphp/Twig/pulls{/number}","milestones_url":"https://api.github.com/repos/twigphp/Twig/milestones{/number}","notifications_url":"https://api.github.com/repos/twigphp/Twig/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/twigphp/Twig/labels{/name}","releases_url":"https://api.github.com/repos/twigphp/Twig/releases{/id}","deployments_url":"https://api.github.com/repos/twigphp/Twig/deployments","created_at":"2009-10-07T21:23:38Z","updated_at":"2016-11-10T10:50:12Z","pushed_at":"2016-11-10T11:00:14Z","git_url":"git://github.com/twigphp/Twig.git","ssh_url":"git@github.com:twigphp/Twig.git","clone_url":"https://github.com/twigphp/Twig.git","svn_url":"https://github.com/twigphp/Twig","homepage":"http://twig.sensiolabs.org/","size":9475,"stargazers_count":3462,"watchers_count":3462,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":858,"mirror_url":null,"open_issues_count":85,"forks":858,"open_issues":85,"watchers":3462,"default_branch":"1.x"}},"_links":{"self":{"href":"https://api.github.com/repos/twigphp/Twig/pulls/2228"},"html":{"href":"https://github.com/twigphp/Twig/pull/2228"},"issue":{"href":"https://api.github.com/repos/twigphp/Twig/issues/2228"},"comments":{"href":"https://api.github.com/repos/twigphp/Twig/issues/2228/comments"},"review_comments":{"href":"https://api.github.com/repos/twigphp/Twig/pulls/2228/comments"},"review_comment":{"href":"https://api.github.com/repos/twigphp/Twig/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/twigphp/Twig/pulls/2228/commits"},"statuses":{"href":"https://api.github.com/repos/twigphp/Twig/statuses/d0e59245f6638afb423f093863aef86f57db6251"}}}}
{"actor":{"display_login":"stof"}}