{"action":"created","comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/70564895","id":70564895,"diff_hunk":"@@ -469,11 +473,40 @@ public static function loadByPsr0($class)\n \n \t\t$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';\n \n+\t\t// Root namespaces for PSR-0 loader\n+\t\t$psr0_roots = array(\n+\t\t\t'Admin' => array(JPATH_ROOT),\n+\t\t\t'Components' => array(JPATH_ROOT),\n+\t\t\t'Libraries' => array(JPATH_ROOT),\n+\t\t\t'Plugins' => array(JPATH_ROOT)\n+\t\t);\n+\n+\t\t$namespaces = array_merge(self::$namespaces, $psr0_roots);\n+\n \t\t// Loop through registered namespaces until we find a match.\n-\t\tforeach (self::$namespaces as $ns => $paths)\n+\t\tforeach ($namespaces as $ns => $paths)\n \t\t{\n \t\t\tif (strpos($class, $ns) === 0)\n \t\t\t{\n+\t\t\t\tif ($ns=='Admin')","path":"libraries/loader.php","position":38,"original_position":38,"commit_id":"85404f0de41f8d1724886090760c955e427421f8","original_commit_id":"85404f0de41f8d1724886090760c955e427421f8","user":{"login":"gunjanpatel","id":2002921,"avatar_url":"https://avatars.githubusercontent.com/u/2002921?v=3","gravatar_id":"","url":"https://api.github.com/users/gunjanpatel","html_url":"https://github.com/gunjanpatel","followers_url":"https://api.github.com/users/gunjanpatel/followers","following_url":"https://api.github.com/users/gunjanpatel/following{/other_user}","gists_url":"https://api.github.com/users/gunjanpatel/gists{/gist_id}","starred_url":"https://api.github.com/users/gunjanpatel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gunjanpatel/subscriptions","organizations_url":"https://api.github.com/users/gunjanpatel/orgs","repos_url":"https://api.github.com/users/gunjanpatel/repos","events_url":"https://api.github.com/users/gunjanpatel/events{/privacy}","received_events_url":"https://api.github.com/users/gunjanpatel/received_events","type":"User","site_admin":false},"body":"Not sure why travis is not complain but it should be `if ($ns == 'Admin')` to follow standard. ","created_at":"2016-07-13T05:07:25Z","updated_at":"2016-07-13T05:07:25Z","html_url":"https://github.com/joomla/joomla-cms/pull/11061#discussion_r70564895","pull_request_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/11061","_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments/70564895"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/11061#discussion_r70564895"},"pull_request":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/11061"}}},"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/11061","id":76860420,"html_url":"https://github.com/joomla/joomla-cms/pull/11061","diff_url":"https://github.com/joomla/joomla-cms/pull/11061.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/11061.patch","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/11061","number":11061,"state":"open","locked":false,"title":"JLoader: add PSR-4, fix PSR-0","user":{"login":"alex7r","id":18716997,"avatar_url":"https://avatars.githubusercontent.com/u/18716997?v=3","gravatar_id":"","url":"https://api.github.com/users/alex7r","html_url":"https://github.com/alex7r","followers_url":"https://api.github.com/users/alex7r/followers","following_url":"https://api.github.com/users/alex7r/following{/other_user}","gists_url":"https://api.github.com/users/alex7r/gists{/gist_id}","starred_url":"https://api.github.com/users/alex7r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex7r/subscriptions","organizations_url":"https://api.github.com/users/alex7r/orgs","repos_url":"https://api.github.com/users/alex7r/repos","events_url":"https://api.github.com/users/alex7r/events{/privacy}","received_events_url":"https://api.github.com/users/alex7r/received_events","type":"User","site_admin":false},"body":"#### Autoload namespaces according to PSR4\r\n\r\n#### Summary of Changes\r\nAdded fix for \"PSR0 fix\" so it would not conflict by any means with PSR4 loader\r\n\r\n- [x] PSR-4 namespaces autoloading\r\n- [x] Autoload current MVC with PSR-4 namespaces if needed\r\n- [x] Autoload current modules and plugins with PSR-4 namespaces if needed\r\n- [ ] Remove some comments after maintainer verify code\r\n\r\n#### Testing Instructions\r\nTesting classes that corresponds to convention\r\nhttps://volunteer.joomla.org/reports/115-joomla-4-architecture-sprint-odense-dk\r\n\r\nTest by *simple*\r\n```PHP\r\nclass_exists(CLASSTOLOAD,true);\r\n```\r\nor by *dumb*\r\n```PHP\r\n$var = new CLASSTOLOAD();\r\n```\r\nKeep in mind that errors may appear. Task is to load proper class.\r\n\r\n*I've tested by dumb way*:\r\n**part a**\r\n```PHP\r\n$var = new Joomla\\Component\\Content\\Site\\View\\Article();\r\n\r\n$var = new Joomla\\Component\\Content\\Admin\\View\\Article();\r\n\r\n$var = new Joomla\\Component\\Content\\Admin\\Model\\Articles();\r\n\r\n$var = new Joomla\\Component\\Content\\Admin\\Helper\\Content();\r\n\r\n// next triggers http://forum.joomla.org/viewtopic.php?t=613877 somehow\r\n// but can be checked as \"Completed\" because error cause lays deeper and ContentControllerArticle is accessable\r\n$var = new Joomla\\Legacy\\Controller\\Form();\r\n$var = new Joomla\\Component\\Content\\Site\\Controller\\Article();\r\n```\r\n**part b**\r\n```PHP\r\n// Works but have issues as Akeeba already using one namespaces\r\n// and their auto loader is not called, so FOF30\\Model\\Model is not found\r\n$var = new Akeeba\\Backup\\Admin\\Model\\Log();\r\n```\r\nNot many 3rd party components tested, but core components are passing almost same way, so...\r\n\r\n**part c**\r\n```PHP\r\n// has not a lot modules so go with standard\r\n$var = new Core\\Module\\Site\\BreadCrumbs\\Helper();\r\n$var = new Core\\Module\\Admin\\Feed\\Helper();\r\n\r\n$var = new Akeeba\\Plugin\\System\\Akeebaupdatecheck();\r\n$var = new Core\\Plugin\\System\\Log\\Helper();\r\n$var = new Core\\Plugin\\System\\Log();\r\n```\r\n**part d**\r\n```PHP\r\n$var = new Joomla\\Access\\Wrapper\\Access();\r\n$var = new Joomla\\Access\\Rule();\r\n\r\n$var = new Joomla\\Mail\\Mail();\r\n// equal to\r\n$var = new Joomla\\Mail();\r\n\r\n// I get Fatal Errors this is interface and abstract classes\r\n// but for autoloader I gues this is success...\r\n$var = new Joomla\\Controller\\Base();\r\n$var = new Joomla\\Controller();\r\n```\r\n**part e**\r\n```PHP\r\n$var = new Joomla\\CMS\\Captcha();\r\n```\r\n____\r\n@wilsonge , @photodude , may be someone else will take a look at it, or simply test this to?","created_at":"2016-07-10T00:10:57Z","updated_at":"2016-07-13T05:07:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"32acece00dd4e57199bb46e65fd7f74848f5e57d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/11061/commits","review_comments_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/11061/comments","review_comment_url":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/11061/comments","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/85404f0de41f8d1724886090760c955e427421f8","head":{"label":"alex7r:alex7r-loader-patch-1","ref":"alex7r-loader-patch-1","sha":"85404f0de41f8d1724886090760c955e427421f8","user":{"login":"alex7r","id":18716997,"avatar_url":"https://avatars.githubusercontent.com/u/18716997?v=3","gravatar_id":"","url":"https://api.github.com/users/alex7r","html_url":"https://github.com/alex7r","followers_url":"https://api.github.com/users/alex7r/followers","following_url":"https://api.github.com/users/alex7r/following{/other_user}","gists_url":"https://api.github.com/users/alex7r/gists{/gist_id}","starred_url":"https://api.github.com/users/alex7r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex7r/subscriptions","organizations_url":"https://api.github.com/users/alex7r/orgs","repos_url":"https://api.github.com/users/alex7r/repos","events_url":"https://api.github.com/users/alex7r/events{/privacy}","received_events_url":"https://api.github.com/users/alex7r/received_events","type":"User","site_admin":false},"repo":{"id":58201326,"name":"joomla-cms","full_name":"alex7r/joomla-cms","owner":{"login":"alex7r","id":18716997,"avatar_url":"https://avatars.githubusercontent.com/u/18716997?v=3","gravatar_id":"","url":"https://api.github.com/users/alex7r","html_url":"https://github.com/alex7r","followers_url":"https://api.github.com/users/alex7r/followers","following_url":"https://api.github.com/users/alex7r/following{/other_user}","gists_url":"https://api.github.com/users/alex7r/gists{/gist_id}","starred_url":"https://api.github.com/users/alex7r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alex7r/subscriptions","organizations_url":"https://api.github.com/users/alex7r/orgs","repos_url":"https://api.github.com/users/alex7r/repos","events_url":"https://api.github.com/users/alex7r/events{/privacy}","received_events_url":"https://api.github.com/users/alex7r/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alex7r/joomla-cms","description":"Home of the Joomla! Content Management System","fork":true,"url":"https://api.github.com/repos/alex7r/joomla-cms","forks_url":"https://api.github.com/repos/alex7r/joomla-cms/forks","keys_url":"https://api.github.com/repos/alex7r/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alex7r/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alex7r/joomla-cms/teams","hooks_url":"https://api.github.com/repos/alex7r/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/alex7r/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/alex7r/joomla-cms/events","assignees_url":"https://api.github.com/repos/alex7r/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/alex7r/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/alex7r/joomla-cms/tags","blobs_url":"https://api.github.com/repos/alex7r/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alex7r/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alex7r/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/alex7r/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alex7r/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/alex7r/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/alex7r/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/alex7r/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/alex7r/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/alex7r/joomla-cms/subscription","commits_url":"https://api.github.com/repos/alex7r/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/alex7r/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/alex7r/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/alex7r/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/alex7r/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/alex7r/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alex7r/joomla-cms/merges","archive_url":"https://api.github.com/repos/alex7r/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alex7r/joomla-cms/downloads","issues_url":"https://api.github.com/repos/alex7r/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/alex7r/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/alex7r/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/alex7r/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alex7r/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/alex7r/joomla-cms/releases{/id}","deployments_url":"https://api.github.com/repos/alex7r/joomla-cms/deployments","created_at":"2016-05-06T11:00:01Z","updated_at":"2016-05-06T11:00:15Z","pushed_at":"2016-07-09T23:43:13Z","git_url":"git://github.com/alex7r/joomla-cms.git","ssh_url":"git@github.com:alex7r/joomla-cms.git","clone_url":"https://github.com/alex7r/joomla-cms.git","svn_url":"https://github.com/alex7r/joomla-cms","homepage":"https://www.joomla.org","size":154049,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"staging"}},"base":{"label":"joomla:staging","ref":"staging","sha":"71452ea20f8242eed9e5652850b365f633a257b0","user":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"repo":{"id":2464908,"name":"joomla-cms","full_name":"joomla/joomla-cms","owner":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joomla/joomla-cms","description":"Home of the Joomla! Content Management System","fork":false,"url":"https://api.github.com/repos/joomla/joomla-cms","forks_url":"https://api.github.com/repos/joomla/joomla-cms/forks","keys_url":"https://api.github.com/repos/joomla/joomla-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joomla/joomla-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joomla/joomla-cms/teams","hooks_url":"https://api.github.com/repos/joomla/joomla-cms/hooks","issue_events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/events{/number}","events_url":"https://api.github.com/repos/joomla/joomla-cms/events","assignees_url":"https://api.github.com/repos/joomla/joomla-cms/assignees{/user}","branches_url":"https://api.github.com/repos/joomla/joomla-cms/branches{/branch}","tags_url":"https://api.github.com/repos/joomla/joomla-cms/tags","blobs_url":"https://api.github.com/repos/joomla/joomla-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joomla/joomla-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joomla/joomla-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/joomla/joomla-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joomla/joomla-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/joomla/joomla-cms/languages","stargazers_url":"https://api.github.com/repos/joomla/joomla-cms/stargazers","contributors_url":"https://api.github.com/repos/joomla/joomla-cms/contributors","subscribers_url":"https://api.github.com/repos/joomla/joomla-cms/subscribers","subscription_url":"https://api.github.com/repos/joomla/joomla-cms/subscription","commits_url":"https://api.github.com/repos/joomla/joomla-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/joomla/joomla-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/joomla/joomla-cms/contents/{+path}","compare_url":"https://api.github.com/repos/joomla/joomla-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joomla/joomla-cms/merges","archive_url":"https://api.github.com/repos/joomla/joomla-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joomla/joomla-cms/downloads","issues_url":"https://api.github.com/repos/joomla/joomla-cms/issues{/number}","pulls_url":"https://api.github.com/repos/joomla/joomla-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/joomla/joomla-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/joomla/joomla-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joomla/joomla-cms/labels{/name}","releases_url":"https://api.github.com/repos/joomla/joomla-cms/releases{/id}","deployments_url":"https://api.github.com/repos/joomla/joomla-cms/deployments","created_at":"2011-09-27T02:07:38Z","updated_at":"2016-07-13T00:57:59Z","pushed_at":"2016-07-12T23:48:50Z","git_url":"git://github.com/joomla/joomla-cms.git","ssh_url":"git@github.com:joomla/joomla-cms.git","clone_url":"https://github.com/joomla/joomla-cms.git","svn_url":"https://github.com/joomla/joomla-cms","homepage":"https://www.joomla.org","size":282646,"stargazers_count":2068,"watchers_count":2068,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2223,"mirror_url":null,"open_issues_count":554,"forks":2223,"open_issues":554,"watchers":2068,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/11061"},"html":{"href":"https://github.com/joomla/joomla-cms/pull/11061"},"issue":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/11061"},"comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/issues/11061/comments"},"review_comments":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/11061/comments"},"review_comment":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/joomla/joomla-cms/pulls/11061/commits"},"statuses":{"href":"https://api.github.com/repos/joomla/joomla-cms/statuses/85404f0de41f8d1724886090760c955e427421f8"}}}}
{"actor":{"display_login":"gunjanpatel"}}