Actions

J3.x

Difference between revisions of "Missing JBrowser class after upgrading"

From Joomla! Documentation

m (Afected versions: spelling and comma)
m (heading)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{notice|This issue only affects '''some''' 3rd party extensions in Joomla! versions 3.1.4 and higher}}
+
After update to Joomla 3.1.4 or later, some some extensions that depend on the native autoloader, with a working code before, may stop working.
  
== Typical error message ==
+
==Errors reported==
 
<pre>
 
<pre>
 
Fatal error: Class 'JBrowser' not found in path/to/file.php on line XY
 
Fatal error: Class 'JBrowser' not found in path/to/file.php on line XY
 
</pre>
 
</pre>
  
== Affected versions ==
+
== Versions affected ==
After update to Joomla 3.1.4, some some extensions that depend on the native autoloader, with a working code before, may stop working.
+
{{refers_to|3.1.4,3.1.5}}
 +
{{notice|This issue only affects '''some''' 3rd party extensions in Joomla! versions 3.1.4 and higher|imagesize=25px}}
  
== Workaround ==
+
== What is the cause==
While this is not resolved, change the source code from something similar to this
+
An instance of Joomla! Core using JBrowser has been removed causing it not to be automatically loaded on all pages.
  
 +
== How to fix ==
 +
Change the source code to something similar as below.
 +
 +
From this:
 
<source lang="php">
 
<source lang="php">
 
$browser = JBrowser::getInstance();
 
$browser = JBrowser::getInstance();
Line 17: Line 22:
 
</source>
 
</source>
  
To this (with legacy way to load classes)
+
To this (with legacy way to load classes):
 
<source lang="php">
 
<source lang="php">
 
JLoader::import('joomla.environment.browser') // Add this linecode
 
JLoader::import('joomla.environment.browser') // Add this linecode
Line 26: Line 31:
 
[[Category:Version 3.1.4 FAQ]]
 
[[Category:Version 3.1.4 FAQ]]
 
[[Category:Version 3.1.5 FAQ]]
 
[[Category:Version 3.1.5 FAQ]]
[[Category:Version 3.1 FAQ]]
 

Latest revision as of 20:17, 12 August 2013

After update to Joomla 3.1.4 or later, some some extensions that depend on the native autoloader, with a working code before, may stop working.

Contents

Errors reported

Fatal error: Class 'JBrowser' not found in path/to/file.php on line XY

Versions affected

Info non-talk.png
General Information

This pertains only to Joomla! version(s):- 3.1.4  3.1.5

Info non-talk.png
General Information

This issue only affects some 3rd party extensions in Joomla! versions 3.1.4 and higher

What is the cause

An instance of Joomla! Core using JBrowser has been removed causing it not to be automatically loaded on all pages.

How to fix

Change the source code to something similar as below.

From this:

$browser = JBrowser::getInstance();
//...

To this (with legacy way to load classes):

JLoader::import('joomla.environment.browser') // Add this linecode
$browser = JBrowser::getInstance();
//...