- Posts: 6
COMMUNITY FORUM
Error: Class 'K2Table' not found in k2user.php
- MaTsch
-
Topic Author
- Offline
- New Member
I searched for help in the forum, but didn't find a solution yet... I use Joomla v2.5.7 (with Community Builder v1.8.1). I upgraded K2 from v2.5.7 to v2.6.1 and all my registered visitors got that fatal error ("Fatal error: Class 'K2Table' not found in xxx/administrator/components/com_k2/tables/k2user.php on line 13").
If I clear my browser's cache and cookies the site works as intented. But the error can be reproduced with the following three steps:
1.) Check the box "Remember Me" and log in.
2.) Close your browser while being logged in.
3.) Open your browser and visit the site again. The error message appears again.
I can get rid of that error again and again by clearing my browser's cache and cookies as stated above. But that error will come back after closing my browser while being logged in. For me it seems like an error with the cookies... A new install of the version 2.6.1 didn't help. Any idea how to fix that? Thanks in advance!
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- MaTsch
-
Topic Author
- Offline
- New Member
- Posts: 6
I user mod_cblogin (the login module of the Community Builder). The other two (mod_login and k2_user) are un-published...
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- MaTsch
-
Topic Author
- Offline
- New Member
- Posts: 6
Please Log in or Create an account to join the conversation.
- Jasper
-
- Offline
- New Member
- Posts: 7
After a user has been logged in. session expired and then logges in again the errror comes up!
User IS available in the K2 users database.
I have set k2 system plugin to -1 and i'll test more.
When i know more i'll post it here
Jasper
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Is the issue solved? Please provide some feedback on this.
Please Log in or Create an account to join the conversation.
- Jasper
-
- Offline
- New Member
- Posts: 7
Jasper
Please Log in or Create an account to join the conversation.
- MaTsch
-
Topic Author
- Offline
- New Member
- Posts: 6
(Sorry for the late reply, guys. I didn't have the time to install and test it until today.)
Please Log in or Create an account to join the conversation.
- MaTsch
-
Topic Author
- Offline
- New Member
- Posts: 6
Does anybody know how this can be fixed?
My configuration:
Joomla! v2.5.8
Community Builder v1.9
K2 v2.6.2
Kunena v2.0.3
Please Log in or Create an account to join the conversation.
- vtmod
-
- Offline
- New Member
- Posts: 19
we've encountered the same problem. I can't authenticate through a webs-service with Joomla when the K2-User Plugin is on.
Its a standard installation and my Joomla-Web-Service is done properly and never had a problem, since the K2-User-Plugin.
However, please fix this soon.
PHP Fatal error: Class 'K2Table' not found in /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/administrator/components/com_k2/tables/k2user.php on line 14
[27-May-2013 16:02:08] PHP Stack trace:
[27-May-2013 16:02:08] PHP 1. {main}() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/components/com_xas/xapp/index.php:0
[27-May-2013 16:02:08] PHP 2. Xapp_Rpc_Gateway->run() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/components/com_xas/xapp/index.php:75
[27-May-2013 16:02:08] PHP 3. Xapp_Rpc_Server->handle() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/components/com_xas/xapp/lib/rpc/lib/vendor/xapp/Rpc/Gateway.php:785
[27-May-2013 16:02:08] PHP 4. Xapp_Rpc_Server_Json->execute() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/components/com_xas/xapp/lib/rpc/lib/vendor/xapp/Rpc/Server.php:620
[27-May-2013 16:02:08] PHP 5. Xapp_Rpc_Server->invoke() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/components/com_xas/xapp/lib/rpc/lib/vendor/xapp/Rpc/Server/Json.php:317
[27-May-2013 16:02:08] PHP 6. call_user_func_array() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/components/com_xas/xapp/lib/rpc/lib/vendor/xapp/Rpc/Server.php:531
[27-May-2013 16:02:08] PHP 7. login() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/components/com_xas/xapp/lib/rpc/lib/vendor/xapp/Rpc/Server.php:0
[27-May-2013 16:02:08] PHP 8. XAppJoomlaAuth->loginUser() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/components/com_xas/xapp/serviceRouter.php:59
[27-May-2013 16:02:08] PHP 9. JSite->login() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/components/com_xas/xapp/lib/joomla/XAppJoomlaAuth.php:27
[27-May-2013 16:02:08] PHP 10. JApplication->login() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/includes/application.php:295
[27-May-2013 16:02:08] PHP 11. JApplication->triggerEvent() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/libraries/joomla/application/application.php:711
[27-May-2013 16:02:08] PHP 12. JDispatcher->trigger() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/libraries/joomla/application/application.php:642
[27-May-2013 16:02:08] PHP 13. JEvent->update() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/libraries/joomla/event/dispatcher.php:161
[27-May-2013 16:02:08] PHP 14. call_user_func_array() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/libraries/joomla/event/event.php:71
[27-May-2013 16:02:08] PHP 15. plgUserK2->onUserLogin() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/libraries/joomla/event/event.php:0
[27-May-2013 16:02:08] PHP 16. plgUserK2->onLoginUser() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/plugins/user/k2/k2.php:31
[27-May-2013 16:02:08] PHP 17. JTable::getInstance() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/plugins/user/k2/k2.php:180
[27-May-2013 16:02:08] PHP 18. include_once() /Volumes/mac750250/Applications/MAMP/htdocs/joomla257/libraries/joomla/database/table.php:175
thank you.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
I can see a lot of errors are from the com_xas extension. Have you tried reordering the plugins or disabling the K2 user plugin ?
Please Log in or Create an account to join the conversation.
- vtmod
-
- Offline
- New Member
- Posts: 19
as far I can see in the stack-trace, the crash comes from you :
PHP Fatal error: Class 'K2Table' not found in /com_k2/tables/k2user.php
Re-ordering or disabling is not an option. Your component shouldn't crash at all at the login chain. Basically this crash causes that people can't use our component without explaining them that the K2-User-Plugin must be reordered or disabled.
Please fix this. Thank you. The crash comes also up with other webservice based plugins which use the Joomla-API to authenticate a user.
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
First of all you didn't mention what version of Joomla! and K2 you are using. Ensure that both of them are up to date. For your information K2Table class is loaded by the K2 system plugin on the "onAfterInitialise" event in order to make the class available to the system. You can see the code at file /plugins/system/k2/k2.php line 414. So first of all you need to ensure that K2 system plugin is enabled, since this is a requirement for K2 in order to operate. Beyond this, i cannot know what your extension is doing and why the class is not available. In any case you can still use a simple require_once to the table.php file and fix the issue.
Please Log in or Create an account to join the conversation.
- vtmod
-
- Offline
- New Member
- Posts: 19
thank you. We're testing against the latest versions of K2 and the Joomla 2.5.x series. We do this tests always with fresh and standard installations.
Does that mean you are not fixing your own code and leave it to us ? Please confirm this. There is no problem to bloat our code because of other plugins, we are used to this since we're working for Joomla :-)
Please Log in or Create an account to join the conversation.
- vtmod
-
- Offline
- New Member
- Posts: 19
$userId = -1;
$credentials = array('username' => $username, 'password' => $password);
$options = array('silent' => true);
$app = JFactory::getApplication();
// Save our guest session so we can destroy it.
$session = JFactory::getSession();
$guestSessionId = $session->getId();
// Login will create a new session
$successfulLogin = $app->login($credentials, $options);
// Destroy guest session row. Login forks the session and we will end up with a bunch of guest rows if we don't.
jimport('joomla.database.table');
$storage = & JTable::getInstance('session');
$storage->delete($guestSessionId);
Whilst the authentification, its crashing in your component whilst it shouldn't at all.
And introducing 'bug' fixes within our code for other plugins shouldn't be the way, or ? It also shouldn't matter what our plugin does.
The methods your describe to get around your bug is not acceptable for standard installation or user. I mean how is doing such things ? This is against all QA policies we know.
thank you
please don't find this offending. its just annoying to make such huge efforts
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- vtmod
-
- Offline
- New Member
- Posts: 19
And lol, adding bug fixes for other plugins : no worry, as said we are used to this kind of 'working' with Joomla and its plugin developers. That was not a joke but seriously, this is how it works here ?
Btw, you've got all what you need. simply use the login example function and you will see what your software does : crash at a very important platform function.
Please Log in or Create an account to join the conversation.
- vtmod
-
- Offline
- New Member
- Posts: 19
function onLoginUser($user, $options)
{
$params = JComponentHelper::getParams('com_k2');
$mainframe = JFactory::getApplication();
if ($mainframe->isSite())
{
$tmp = JFactory::getUser();
$db = JFactory::getDBO();
$db->setQuery("SELECT id FROM #__users WHERE username = ".$db->Quote($user));
$id = $db->loadResult();
if ($id)
{
$k2id = $this->getK2UserID($id);
}
else
{
$k2id = false;
}
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'tables');
JLoader::register('K2Table', JPATH_ADMINISTRATOR.'/components/com_k2/tables/table.php');
$row = JTable::getInstance('K2User', 'Table');
if ($k2id)
{
$row->load($k2id);
}
else
{
$row->set('userID', $tmp->id);
$row->set('userName', $tmp->name);
$row->set('group', $params->get('K2UserGroup', 1));
}
$row->ip = $_SERVER;
$row->hostname = gethostbyaddr($_SERVER);
$row->store();
if ($params->get('cookieDomain') && $id)
{
setcookie("userID", $id, 0, '/', $params->get('cookieDomain'), 0);
}
}
return true;
}
So, finally. No need to force users to do 'strange' things like 'disabling' or 'reordering' your own plugin. I'm glad you see it like me :-)
Please Log in or Create an account to join the conversation.
- vtmod
-
- Offline
- New Member
- Posts: 19
is there an estimate when this bug will fixed, or when it will be available in a next release ?
We've a dozen of people a day reporting the problem and its really tedious to tell them, that the K2 user plugin must be disabled whilst logging into Joomla through our plugin.
Thank you very much.
Please Log in or Create an account to join the conversation.