Hi,

on a brandnew Joomla installation I get errors when I go to
Extensions > Templates > t3_bs3_blank - Standard > Theme

Above the Theme-formfield a Warning comes up:

Warning: Invalid argument supplied for foreach() in /xxxxx/joomla/plugins/system/t3/includes/depend/t3folderlist.php on line 61 Call Stack: 0.0001 405384 1. {main}() /xxxxx/joomla/administrator/index.php:0 0.0195 1444784 2. Joomla\CMS\Application\AdministratorApplication->execute() /xxxxx/joomla/administrator/index.php:51 0.3265 3055648 3. Joomla\CMS\Application\AdministratorApplication->render() /xxxxx/joomla/libraries/src/Application/CMSApplication.php:202 0.3265 3055688 4. Joomla\CMS\Application\AdministratorApplication->render() /xxxxx/joomla/libraries/src/Application/AdministratorApplication.php:450 0.3910 3384960 5. Joomla\CMS\Application\AdministratorApplication->triggerEvent() /xxxxx/joomla/libraries/src/Application/CMSApplication.php:1050 0.3910 3384960 6. JEventDispatcher->trigger() /xxxxx/joomla/libraries/src/Application/BaseApplication.php:108 0.3911 3385400 7. plgSystemT3->update() /xxxxx/joomla/libraries/joomla/event/dispatcher.php:160 0.3911 3385400 8. plgSystemT3->onAfterRender() /xxxxx/joomla/libraries/joomla/event/event.php:70 0.3911 3385400 9. T3Admin->render() /xxxxx/joomla/plugins/system/t3/t3.php:194 0.3914 3403016 10. T3Admin->renderAdmin() /xxxxx/joomla/plugins/system/t3/includes/core/admin.php:34 0.4027 3408176 11. include('/xxxxx/joomla/plugins/system/t3/admin/tpls/default.php') /xxxxx/joomla/plugins/system/t3/includes/core/admin.php:277 0.4590 3435192 12. JFormFieldT3FolderList->get() /xxxxx/joomla/plugins/system/t3/admin/tpls/default.php:121 0.4590 3435192 13. JFormFieldT3FolderList->get() /xxxxx/joomla/libraries/joomla/form/fields/folderlist.php:102 0.4590 3435192 14. JFormFieldT3FolderList->__get() /xxxxx/joomla/libraries/joomla/form/fields/list.php:277 0.4590 3435192 15. JFormFieldT3FolderList->getInput() /xxxxx/joomla/libraries/src/Form/FormField.php:425 0.4590 3435192 16. JFormFieldT3FolderList->getOptions() /xxxxx/joomla/libraries/joomla/form/fields/list.php:58

What is that and how can I solve this issue?

Thanks for your help,
Dirk

    dirk-k
    Hi
    these are the PHP warning only, kindly check you have set the error report to default, its due to current php version does not make any issue, ALso make sure you are using latest version of T3.

    @Ninja No, this is a bug. It will surface on any Linux OS (not on Windows though, probably to another bug that does not matter for this issue, where absolute Windows paths are not recognized as absolute at all).

    One result of this bug is, that the Theme combo box in the style configuration will be empty.

    The problem is this line (around t3folderlist.php:57):

    $paths = T3Path::getAllPath ($path);

    It will return absolute paths, that will be mishandled as relative paths later in Joomla's own JFormFieldFolderList::getOptions() when calling the following line (around t3folderlist.php:60):

    $tmps = parent::getOptions();

    The method concatenates two absolute paths to each other (on Linux based OS) and then returns null, because the path is not a valid directory.

    To fix this issue, make the following change (around t3folderlist.php:57):

    $paths = T3Path::getAllPath ($path, true); /* BUGFIX: add relative: true*/

      gemos-berlin
      Hi
      Can you share the PHP version you are using so i can check the same on latest T3 ?
      I tested it on PHP 7.3 and latest T3 framework, there is no error there.

      Ubuntu 16.04.6 LTS
      PHP 7.3.15
      Joomla 3.9.16
      T3 Framework 2.7.5

      This is not a PHP version issue.

      You are debugging this on Linux, correct? You can experience this issue only on file systems that use a slash as the root symbol (Windows uses a drive letter, so it is not an issue there, though the code would still be wrong).

      Let's assume a base path of /var/www/vhosts/mydomain.com/httpdocs (which will be the value of JPATH_ROOT) and the purity_iii template. We run the original code, without the bugfix.

      In t3folderlist.php:60 the following line will be executed:

      $tmps = parent::getOptions();

      At this point in time $this->directory will have the value /var/www/vhosts/mydomain.com/httpdocs/templates/purity_iii/less/themes (so the absolute path).

      In the called function JFormFieldFolderList::getOptions() in folderlist.php:187, the following line is being executed:

      $path = ltrim($this->directory, '/');

      This will remove the leading slash and thus make $path relative. It has now the value var/www/vhosts/mydomain.com/httpdocs/templates/purity_iii/less/themes.

      Then the following line will be executed:

      if (!is_dir($path))

      It checks, whether the path points to a valid directory, which is not the case, because this relative path does not exist (the absolute path with the leading slash would have existed).

      The the following line will be executed:

      if (is_dir(JPATH_ROOT . '/' . $path))

      It checks whether the concatenation of JPATH_ROOT and $path is a valid path. The concatendation will look like this:

      /var/www/vhosts/mydomain.com/httpdocs/var/www/vhosts/mydomain.com/httpdocs/templates/purity_iii/less/themes

      So this is obviously also an invalid path.
      Then the method returns (with null).

      So it is clear, that the JFormFieldFolderList::getOptions() method does only work correctly, if it is being used on a relative path (because it will make all absolute paths incorrectly to relative paths).

      Therefore, the fix I proposed in my previous post is the solution to the issue and will work on all systems (not just Linux but also Windows).

        gemos-berlin
        Hi
        Kindly update T3 to latest version first. I will and let me know if there is any error . Also set the error report to default.
        If you can submit temp super user login details in Edit fields it will help more as i have Windows and Linux system.

        Well, the commit Fix custom Theme not available after update to Joomla 3.9.16 (which is part of T3 2.7.6) does exactly what I proposed.

        As written above, I was using T3 2.7.5, so using the patch release will fix this issue for me.

        I trusted the following message on the template page on my Joomla site:

        Congrats! You are using latest version of T3 Framework!
        Your version is 2.7.5

        It does not instruct me to download the 2.7.6 package there. Of course manually downloading and installing the package works.

        So while updating to T3 2.7.6 does fix the issue, you might want to fix the false message/update check on the template page, because it would have saved us a lot of time.

          gemos-berlin
          Hi
          New T3 version already released, you can open the download page of T3 blank and download it.
          Regards

          a year later
          Ninja locked the discussion.
          Write a Reply...
          You need to Login to view replies.