Fatal error w Google Crome, Joomla 1.5 only; getValue('application.data.lang')

Started by Thomas Kuschel, June 26, 2012, 12:10:18 PM

Previous topic - Next topic

Thomas Kuschel

I've found a rarely fatal error with the combination of
Google Chrome, Joomla 1.5.x, and VirtueMart 2.0.6
within the file administrator/components/com_virtuemart/helpers/config.php at line 478:
Error Log:
[Tue Jun 26 10:36:33 2012] [error] [client 213.47.63.13] PHP Fatal error:  Call to a member function getValue() on a non-object in /var/www/cms/administrator/components/com_virtuemart/helpers/config.php on line 478
Afterwards, the website is NOT loading with google chrome browser any more. E.g. with IE it still works.

I have changed the code in the branch for joomla 1.5 in the same way as of Joomla > 1.6 inside the config.php file - then it works well (tested).
I don't know why the language is stored inside the session, with > Joomla 1.6; this is not used any more?

Regards Thomas.

Here is my changed code of method setdbLanguageTag() with not removed comment lines:
/*
* Set defaut language tag for translatable table
*
* @author Patrick Kohl
* @return string valid langtag
*/
public function setdbLanguageTag($langTag = 0) {

if (self::$_jpConfig->lang ) return self::$_jpConfig->lang;

$langs = (array)self::$_jpConfig->get('active_languages',array());
$isBE = !JFactory::getApplication()->isSite();
if($isBE){
$siteLang = JRequest::getVar('vmlang',FALSE );// we must have this for edit form save
//Why not using the usterstae?
} else {
//if ( JVM_VERSION===1 ) {
// try to find in session lang
// this work with joomfish j1.5 (application.data.lang)
/*
$session  =JFactory::getSession();
$registry =& $session->get('registry');
$siteLang = $registry->getValue('application.data.lang');
} else  {
// TODO test with j1.7
jimport('joomla.language.helper');
$languages = JLanguageHelper::getLanguages('lang_code');
$siteLang = JFactory::getLanguage()->getTag();
}
if (!isset($siteLang)) {
// use user default
$lang =JFactory::getLanguage();
$siteLang = $lang->getTag();
}
*/
$siteLang = JFactory::getLanguage()->getTag();
/*//What is the difference of this?
$params = JComponentHelper::getParams('com_languages');
$siteLang = $params->get('site', 'en_gb');

//or this
$siteLang =JFactory::getLanguage()->getTag();
*/
}

if(!in_array($siteLang, $langs)) {
$params = JComponentHelper::getParams('com_languages');
$siteLang = $params->get('site', 'en-GB');//use default joomla
}

self::$_jpConfig->lang = strtolower(strtr($siteLang,'-','_'));
vmdebug('self::$_jpConfig->lang '.self::$_jpConfig->lang);
defined('VMLANG') or define('VMLANG', self::$_jpConfig->lang );

return self::$_jpConfig->lang;

}


and this with removed comments: ;-)
/*
* Set defaut language tag for translatable table
*
* @author Patrick Kohl
* @return string valid langtag
*/
public function setdbLanguageTag($langTag = 0) {

if (self::$_jpConfig->lang ) return self::$_jpConfig->lang;

$langs = (array)self::$_jpConfig->get('active_languages',array());
$isBE = !JFactory::getApplication()->isSite();
if($isBE){
$siteLang = JRequest::getVar('vmlang',FALSE );// we must have this for edit form save
//Why not using the usterstae?
} else {
$siteLang = JFactory::getLanguage()->getTag();
}

if(!in_array($siteLang, $langs)) {
$params = JComponentHelper::getParams('com_languages');
$siteLang = $params->get('site', 'en-GB');//use default joomla
}

self::$_jpConfig->lang = strtolower(strtr($siteLang,'-','_'));
vmdebug('self::$_jpConfig->lang '.self::$_jpConfig->lang);
defined('VMLANG') or define('VMLANG', self::$_jpConfig->lang );

return self::$_jpConfig->lang;

}

Thomas Kuschel, http://loytec.com

[attachment cleanup by admin]

eppenga

This error is also triggered when using Memcached as session handler (which came as an unpleasant surprise on a high volume site). Kr, Ebo