Keyword

Error: Class 'K2Table' not found in k2user.php

More
11 years 4 months ago #105033 by vtmod
Hi,

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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 4 months ago #105034 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Error: Class 'K2Table' not found in k2user.php
Hello guenter,

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 ?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #105035 by vtmod
hi,
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.

More
11 years 4 months ago #105036 by Lefteris
@guenter

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.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #105037 by vtmod
Hi,
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.

More
11 years 4 months ago #105038 by vtmod
This is how we authenticate a user through a web service API :

$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.

More
11 years 4 months ago #105039 by Lefteris
So you prefer to have your software crashing and disappoint your users. instead of adding a line of code? It's fine for me. But just your information, in order to apply a fix we first need to reproduce the issue and of course detect what's causing it. Finally note that this will be done when we have some time to look into it and not now. Please don't find this offending.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #105040 by vtmod
Ok, forget it. we fix it for you. Where can we send the code ?

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.

More
11 years 4 months ago #105041 by vtmod
here, your new login function, taking care about the pre-conditions :

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.

More
11 years 3 months ago #105042 by vtmod
Hi,

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.


Powered by Kunena Forum