{kun´ēzē}
 
(Reading time: 5 - 9 minutes)
04Jul2023

isSite() and isAdmin() fatal errors after updating to Joomla 4

Information
1777 hits Updated: 04 July 2023 Blog

How to fix websites that break after migrating to J! 4.x because of “deprecated code”.

A common experienceI couldn’t tell you how often this problem occurs but the issue arises on The Joomla Forum™ about twice a week. that people have after “successfully” updating from J! 3.10 to J! 4.x is that their website breaks.  It doesn’t happen all the time—i.e. every time people migrate from J! 3.x to J! 4.x—but it can catch people by surprise.  One of the most common reasons why websites will break is because their J! 3.10 site had one or more third-party extensions installed that used “deprecated code”Further information about potential backward compatibility changes J! 4 may be found here:  Potential backward compatibility issues in Joomla 4.  If you didn’t install any third-party extensions then you can ignore the rest of this topicIf you have not installed any third-party extensions in J! 3.10 then your migration to J! 4.x should proceed successfully but there may be other factors—not involving “deprecated code”—that can complicate the upgrade..

As J! 3.10 support comes to an end, people are feeling more pressure to migrate to J! 4.x.  While it’s an admirable aim—to migrate to J! 4.x—it’s remarkable that people have left things until very last moment before starting the upgrade process and may now be regretting that decision.  It was also for this reason that, when I create new websites with J!, I start by using the latest software release.  I don’t want to spend my time patching other people’s mistakes written years ago.

One of the most commonly-encountered problems involves the use of isSite() and isAdmin().  It’s probably outside a novice website manager’s ability to fix these problems themselves and the rationale for triggering a fatal error (instead of a warning) is somewhat technical.  The matter has been discussed at lengthhttps://github.com/joomla/joomla-cms/issues/35380 at GitHub.

Some people may be disappointed (and some people may feel angry).  I don’t have any personal feelings about the issue, myself.  If, on the other hand, people would like to encourage the development team to examine the possibility of change in this regard then I suggest they head over to GitHub and join the conversation there.

If you have the technical skill then it’s reasonably straightforward to make the required changes to your extension(s) and re-code them without the offending isSite() or isAdmin() methods.   If you do not have that skill then the quickest workaround is to restore the website from the backup that you made when you were using J! 3.10, leave the website running at J! 3.10 and contact the people who wrote the extensions that break in J! 4.x to see if they have a workable solution for you.

If you have a website that won’t allow you to login because of one of the fatal errors, the most likely cause is because of a system plugin that makes a reference to the outdated isAdmin() method.  In all likelihood you’ll want to uninstall the broken plugin but, because you cannot login to do that, you need to temporarily disable it.  The easiest workaround to let you login to your broken website because of a plugin that uses isAdmin() is to rename the offending plugin from <problem-plugin>.php to <problem-plugin>.php-old.  For example, suppose you have enabled error tracing on your website and you discover this:

An error has occurred.
0 Call to undefined method Joomla\CMS\Application\AdministratorApplication::isAdmin()
Call stack
# Function	Location
1 () JROOT/plugins/system/falangdriver/falangdriver.php:46
2 plgSystemFalangdriver->__construct() JROOT/libraries/src/Extension/ExtensionManagerTrait.php:242
3 Joomla\CMS\Application\CMSApplication->loadPluginFromFilesystem() JROOT/libraries/src/Extension/ExtensionManagerTrait.php:160
4 Joomla\CMS\Application\CMSApplication->loadExtension() JROOT/libraries/src/Extension/ExtensionManagerTrait.php:99
5 Joomla\CMS\Application\CMSApplication->bootPlugin() JROOT/libraries/src/Plugin/PluginHelper.php:232
6 Joomla\CMS\Plugin\PluginHelper::import() JROOT/libraries/src/Plugin/PluginHelper.php:192
7 Joomla\CMS\Plugin\PluginHelper::importPlugin() JROOT/libraries/src/Application/CMSApplication.php:744
8 Joomla\CMS\Application\CMSApplication->initialiseApp() JROOT/libraries/src/Application/AdministratorApplication.php:312
9 Joomla\CMS\Application\AdministratorApplication->initialiseApp() JROOT/libraries/src/Application/AdministratorApplication.php:165
10 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:293
11 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:61
12 require_once() JROOT/administrator/index.php:32

What this means is that there was an error on line 46 in the file ../plugins/system/falangdriver/falangdriver.php.  The workaround (or temporary solution) in this case is to rename that file as ../plugins/system/falangdriver/falangdriver.old.  Renaming that file will probably let you login to the Joomla backend and you can uninistall the extension that caused the problem.  You can then spend your time fixing the plugin or contact the person who wrote it and re-install the extension if it’s something you need.

All things being equal—assuming no other “deprecated” or defective code—if you find references in your extensions to isSite() or isAdmin(), the corresponding change is to replace:

  • isSite() with isClient('site'), and
  • isAdmin() with isClient('admin').
About the author:

has worked in the information technology industry since 1971 and, since retiring from the workforce in 2007, is a website hobbyist specialising in Joomla, a former member of the Kunena project for more than 8 years, and contributor on The Joomla Forum™. The opinions expressed in this article are entirely those of the author. View his profile here.


2 thoughts on “isSite() and isAdmin() fatal errors after updating to Joomla 4”

  1. Tuesday, 04 July 2023 18:16

    Hi Michael,
    A little addition: I have to note that isSite() and isAdmin were replaced with new standards since Joomla 3.8, not since Joomla 3.10.

    If someone faced this problem right now, it means they did not update thr site since Joomla 3.8 and their site is unsecure and potentially vulnerable and may have "gifts".

    1. Tuesday, 04 July 2023 18:30

      Thanks, Eugene.  You’re correct.  The “new” standards (that deprecated isAdmin() and isSite()) were introduced six years ago with the release of J! 3.8.0.  The problem that is people are only just now discovering that third-party extension developers did not update their products in line with those coding standards and consumers who obtained them are now paying the price.  Things are likely to get even worse when J! 5.0 is released

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 
Trending now