{"issue":{"state":"open","created_at":"2011-11-29T10:39:57Z","updated_at":"2011-11-29T10:40:05Z","user":{"gravatar_id":"256406243346b9253f8610fb1d1e05f6","id":1215373,"url":"https://api.github.com/users/importer","login":"importer","avatar_url":"https://secure.gravatar.com/avatar/256406243346b9253f8610fb1d1e05f6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"comments":7,"body":"The Frontenduser class cannot be correctly extended due to a bug in the implementation of getInstance method.\n\nCurrent method line 173\n`self::$objInstance = new FrontendUser();`\n\nCorrected\n`self::$objInstance = new self();`\n\nThis allows the extended class to be instantiated as the singleton, rather than FrontendUser class\n\nwhen using `->import('Frontenduser', 'User')` or `->import('myextendedFrontenduser')`\n\nThe extended class is not correctly initialised by the framework without this method being changed.\n\nFor full conversation about why I think this is an error see the forum post here: [http://www.contao-community.org/viewtopic.php?f=9&t=2899]\n\n--- _Originally created by wal5hy on March 30th, 2011, at 01:04am (ID 2969)_","assignee":{"gravatar_id":"87d2e5aefadcb310f9155df28c2b3582","id":1192057,"url":"https://api.github.com/users/leofeyer","login":"leofeyer","avatar_url":"https://secure.gravatar.com/avatar/87d2e5aefadcb310f9155df28c2b3582?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"id":2383021,"labels":[{"name":"Feature","color":"4183c4","url":"https://api.github.com/repos/contao/test/labels/Feature"},{"name":"frontend","color":"e6e6e6","url":"https://api.github.com/repos/contao/test/labels/frontend"}],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":2968,"title":"Frontenduser cannot be correctly extended due to getInstance bug","closed_at":null,"html_url":"https://github.com/contao/test/issues/2968","url":"https://api.github.com/repos/contao/test/issues/2968","milestone":{"state":"open","created_at":"2011-11-29T05:27:10Z","due_on":null,"closed_issues":16,"creator":{"gravatar_id":"87d2e5aefadcb310f9155df28c2b3582","id":1192057,"url":"https://api.github.com/users/leofeyer","login":"leofeyer","avatar_url":"https://secure.gravatar.com/avatar/87d2e5aefadcb310f9155df28c2b3582?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"number":37,"description":"Contao 2.11.0 (minor release)","title":"2.11.0","open_issues":11,"url":"https://api.github.com/repos/contao/test/milestones/37"}},"action":"created","comment":{"created_at":"2011-11-29T10:40:05Z","updated_at":"2011-11-29T10:40:05Z","user":{"gravatar_id":"256406243346b9253f8610fb1d1e05f6","id":1215373,"url":"https://api.github.com/users/importer","login":"importer","avatar_url":"https://secure.gravatar.com/avatar/256406243346b9253f8610fb1d1e05f6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"yes, but since this line exists in index.php\n\nline: 59 $this->import('FrontendUser', 'User');\n\nthe base class ( FrontendUser ) is being called before I can override functionality.\n\nmaybe a potential fix is this (changing FrontendUser.php )\n\n`public static function getInstance()\n{\nif (!is_object(self::$objInstance))\n{\nself::$objInstance = new $GLOBALS['TL_USER']['frontend']();\n}\nreturn self::$objInstance;\n}`\n\nThen in a config file add\n`$GLOBALS['TL_USER'] = array\n(\n\t'frontend'   => 'FrontendUser',\n\t'backend'   => 'BackendUser'\n);`\n\nThis means that any other module which uses $this->import('FrontendUser', 'User')\nwould be getting the same extended frontenduser class, therefore data would be consistent across a request.\n\n--- _Originally created by wal5hy on June 15th, 2011, at 02:58pm_","id":2928132,"url":"https://api.github.com/repos/contao/test/issues/comments/2928132"}}