Error post Update to 3.1.26 #1014

Closed
opened 2023-10-19 14:02:23 +00:00 by znorm87 · 24 comments

Steps to reproduce the issue

Update to 3.1.26
Compile Component
Install Component

Expected result

Updated code installed on the site

Actual result

The error produced: Class "Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power" not found
I do not have any powers or superpowers added to the site.

System information (as much as possible)

  • OS Name & Version: Linux
  • MySql Version: 5.7.23-23
  • Apache Version:
  • PHP Version: 8.2.11
  • Joomla Version: 3.10.12
  • JCB Version: 3.1.26
  • Browser: Safari

Additional comments

I attempted to follow the clues and found the superpower that was referenced "Utilities String Helper". I approved the power and included it with my component since it was being referenced:

I now have this error: Class "VDM\Joomla\Utilities\StringHelper" not found

### Steps to reproduce the issue Update to 3.1.26 Compile Component Install Component ### Expected result Updated code installed on the site ### Actual result The error produced: Class "Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power" not found I do not have any powers or superpowers added to the site. ### System information (as much as possible) - OS Name & Version: Linux - MySql Version: 5.7.23-23 - Apache Version: - PHP Version: 8.2.11 - Joomla Version: 3.10.12 - JCB Version: 3.1.26 - Browser: Safari ### Additional comments I attempted to follow the clues and found the superpower that was referenced "Utilities String Helper". I approved the power and included it with my component since it was being referenced: I now have this error: Class "VDM\Joomla\Utilities\StringHelper" not found
Owner

Few remarks:

  • Please make sure to downgrade to PHP 8.0 (Joomla 3 only works on PHP 8.0)
  • Secondly please be sure to use Firefox for the JCB compiler.
  • The new JCB uses superpowers all over and must have internet access the first time you compile a project.
  • During this compilation JCB will call the https://git.vdm.dev/joomla/super-powers system several times to retrieve the powers it needs and add it to your powers area (in JCB), to be used in your project.
  • This is done automatically.
  • Should it fail you will see a list of powers it could not find and load.
  • Make sure that you install/update JCB with the JCB package and that all plugins are activated, in both the Joomla plugin area and in the JCB global options under the compiler tab.

Let me know if this does not resolve your issue.

Few remarks: - Please make sure to downgrade to PHP 8.0 (Joomla 3 only works on PHP 8.0) - Secondly please be sure to use Firefox for the JCB compiler. - The new JCB uses superpowers all over and must have internet access the first time you compile a project. - During this compilation JCB will call the https://git.vdm.dev/joomla/super-powers system several times to retrieve the powers it needs and add it to your powers area (in JCB), to be used in your project. - This is done automatically. - Should it fail you will see a list of powers it could not find and load. - Make sure that you install/update JCB with the [JCB package](https://git.vdm.dev/joomla/pkg-component-builder/archive/master.zip) and that all plugins are activated, in both the Joomla plugin area and in the JCB global options under the compiler tab. Let me know if this does not resolve your issue.
Author

Thank you for being so quick to reply. Lots of this goes way over my head, I am trying to follow along.

I followed your instructions (php8.0, firefox, internet access, all the plugins activated) and I’m still ending up with this error:
Class "VDM\Joomla\Utilities\StringHelper" not found

I clicked on the Init button on the Powers Tab and ended up with this error:
_Error

File at gitea.remote/src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json gave the following error!
Invalid response received from API. The target couldn't be found._

Is this part of the problem?

Thank you for being so quick to reply. Lots of this goes way over my head, I am trying to follow along. I followed your instructions (php8.0, firefox, internet access, all the plugins activated) and I’m still ending up with this error: _Class "VDM\Joomla\Utilities\StringHelper" not found_ I clicked on the Init button on the Powers Tab and ended up with this error: _Error File at gitea.remote/src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json gave the following error! Invalid response received from API. The target couldn't be found._ Is this part of the problem?
Owner

I actually have seen that error before, but I am still not sure where it comes from, I wonder of you activate the debug mode in Joomla, does it give you more info?

I need to know in what class this wrong URL is set.

I actually have seen that error before, but I am still not sure where it comes from, I wonder of you activate the debug mode in Joomla, does it give you more info? I need to know in what class this wrong URL is set.
Owner

After your first compilation you should see the following:

image

After your first compilation you should see the following: ![image](https://git.vdm.dev/attachments/c0214c83-11f8-4ac0-82a4-93c44f3f40a5)
318 KiB
Owner

Running init loads all JCB standard power classes, including those to use gitea, openai and search... and a few more, so that is pulling many classes into the powers area, and when complete should have about 175 +- powers, that look somethings like this:

image

Running init loads all JCB standard power classes, including those to use gitea, openai and search... and a few more, so that is pulling many classes into the powers area, and when complete should have about 175 +- powers, that look somethings like this: ![image](https://git.vdm.dev/attachments/04f34776-b26f-4fa4-a803-a8308c958af3)
288 KiB
Author

I actually have seen that error before, but I am still not sure where it comes from, I wonder of you activate the debug mode in Joomla, does it give you more info?

I need to know in what class this wrong URL is set.

The class is Utilities String Helper.

I deleted all the powers, re-compiled the component, and saw how the classes load into the powers. I compiled again and still have the error: 0
Class "VDM\Joomla\Utilities\StringHelper" not found
Screenshot 2023-10-19 at 11.44.20 AM.png

I also attempted to "activate" the Utilities String Helper and the classes that it referenced or called on and re-complied the component.

Debug mode gave me this when I loaded a SiteView (frontend) for my component:
Call stack

Function Location

1 () JROOT/components/com_learning/helpers/learning.php:785
2 LearningHelper::checkString() JROOT/components/com_learning/controller.php:111
3 LearningController->checkEditView() JROOT/components/com_learning/controller.php:38
4 LearningController->display() JROOT/libraries/src/MVC/Controller/BaseController.php:702
5 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/components/com_learning/learning.php:32
6 require_once() JROOT/libraries/src/Component/ComponentHelper.php:402
7 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:377
8 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:194
9 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:233
10 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:225
11 Joomla\CMS\Application\CMSApplication->execute() JROOT/index.php:49

> I actually have seen that error before, but I am still not sure where it comes from, I wonder of you activate the debug mode in Joomla, does it give you more info? > > I need to know in what class this wrong URL is set. The class is Utilities String Helper. I deleted all the powers, re-compiled the component, and saw how the classes load into the powers. I compiled again and still have the error: _0_ _Class "VDM\Joomla\Utilities\StringHelper" not found_ ![Screenshot 2023-10-19 at 11.44.20 AM.png](/attachments/b09d2595-e476-4952-b8cf-9871d8f40420) I also attempted to "activate" the Utilities String Helper and the classes that it referenced or called on and re-complied the component. Debug mode gave me this when I loaded a SiteView (frontend) for my component: Call stack # Function Location 1 () JROOT/components/com_learning/helpers/learning.php:785 2 LearningHelper::checkString() JROOT/components/com_learning/controller.php:111 3 LearningController->checkEditView() JROOT/components/com_learning/controller.php:38 4 LearningController->display() JROOT/libraries/src/MVC/Controller/BaseController.php:702 5 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/components/com_learning/learning.php:32 6 require_once() JROOT/libraries/src/Component/ComponentHelper.php:402 7 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:377 8 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:194 9 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:233 10 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:225 11 Joomla\CMS\Application\CMSApplication->execute() JROOT/index.php:49
Owner

Okay next you should look at two places in your component:

Both of these should have a spl_autoload_register method that set the auto-loading of the classes.

This should be in place, then at the top of your helper class there should be a new set of use statements. That look something like this:

https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/helpers/componentbuilder.php#L70

These use statement along side the spl_autoload_register loads the classes into your component at runtime. Can you confirm that this code is there?

Then there should now be a new libraries/jcb_powers folder in you component package. This is where the new classes are found.

If this folder or the above mentioned code is not there, then it will explain the issue your having.

So let me know.

Okay next you should look at two places in your component: - [admin/componentbuilder.php](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/componentbuilder.php#L23) - [/admin/helpers/componentbuilder.php](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/helpers/componentbuilder.php#L23) Both of these should have a `spl_autoload_register` method that set the auto-loading of the classes. This should be in place, then at the top of your helper class there should be a new set of `use` statements. That look something like this: https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/helpers/componentbuilder.php#L70 These use statement along side the `spl_autoload_register` loads the classes into your component at runtime. Can you confirm that this code is there? Then there should now be a new [libraries/jcb_powers](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/libraries/jcb_powers) folder in you component package. This is where the new classes are found. If this folder or the above mentioned code is not there, then it will explain the issue your having. So let me know.
Author

The two files admin/componentbuilder.php & /admin/helpers/componentbuilder.php both had the spl_autoload_register method and the use statements were present.

I see the libraries/jcb_powers for component builder but if it should be in the compilation of the component I make (mine is called com_learning) the libraries folder doesn't contain jcb_powers.

Okay next you should look at two places in your component:

Both of these should have a spl_autoload_register method that set the auto-loading of the classes.

This should be in place, then at the top of your helper class there should be a new set of use statements. That look something like this:

https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/helpers/componentbuilder.php#L70

These use statement along side the spl_autoload_register loads the classes into your component at runtime. Can you confirm that this code is there?

Then there should now be a new libraries/jcb_powers folder in you component package. This is where the new classes are found.

If this folder or the above mentioned code is not there, then it will explain the issue your having.

So let me know.

The two files admin/componentbuilder.php & /admin/helpers/componentbuilder.php both had the spl_autoload_register method and the use statements were present. I see the libraries/jcb_powers for component builder but if it should be in the compilation of the component I make (mine is called com_learning) the libraries folder doesn't contain jcb_powers. > Okay next you should look at two places in your component: > > - [admin/componentbuilder.php](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/componentbuilder.php#L23) > - [/admin/helpers/componentbuilder.php](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/helpers/componentbuilder.php#L23) > > Both of these should have a `spl_autoload_register` method that set the auto-loading of the classes. > > This should be in place, then at the top of your helper class there should be a new set of `use` statements. That look something like this: > > https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/admin/helpers/componentbuilder.php#L70 > > These use statement along side the `spl_autoload_register` loads the classes into your component at runtime. Can you confirm that this code is there? > > Then there should now be a new [libraries/jcb_powers](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/libraries/jcb_powers) folder in you component package. This is where the new classes are found. > > If this folder or the above mentioned code is not there, then it will explain the issue your having. > > So let me know.
Member

Hello @Llewellyn,

File at gitea.remote/src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json gave the following error!
Invalid response received from API. The target couldn't be found._

Is this part of the problem?

I also got the same issue, when I hit the init button in the powers area:

Error
File at gitea.remote/src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json gave the following error!
Invalid response received from API. The target couldn't be found.

success
Successfully Initialized all Remote Powers
The local database powers has successfully been synced with the remote repositories.

No other debug info shows up.
No error upon compiling

Hello @Llewellyn, > File at gitea.remote/src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json gave the following error! > Invalid response received from API. The target couldn't be found._ > > Is this part of the problem? I also got the same issue, when I hit the init button in the powers area: ``` Error File at gitea.remote/src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json gave the following error! Invalid response received from API. The target couldn't be found. success Successfully Initialized all Remote Powers The local database powers has successfully been synced with the remote repositories. ``` No other debug info shows up. No error upon compiling
Owner

but if it should be in the compilation of the component I make (mine is called com_learning) the libraries folder doesn't contain jcb_powers.

Yes I am speaking about your compiled component, I am just point to the JCB classes and folders as examples of what you should see in your package.

So if you don't see that folder, it means JCB is not adding it, and it is the cause of your issue.

I am not sure why though... I will have to get back to you.

I know the workaround is to manually link the strings class to you component. But this workaround is not the solution. I will have to investigate this a little more.

> but if it should be in the compilation of the component I make (mine is called com_learning) the libraries folder doesn't contain jcb_powers. Yes I am speaking about your compiled component, I am just point to the JCB classes and folders as examples of what you should see in your package. So if you don't see that folder, it means JCB is not adding it, and it is the cause of your issue. I am not sure why though... I will have to get back to you. I know the workaround is to manually link the strings class to you component. But this workaround is not the solution. I will have to investigate this a little more.
Owner

Please confirm that the plugin are activated in both areas:

  • Joomla plugin area
  • JCB global options

Like this:

Joomla plugin area

image

JCB global options
image

Since I have found that JCB does not add the classes when the Extension - Componentbuilder Powers Autoloader Compiler or the Extension - Componentbuilder Headers Compiler plugin is inactive.

Please confirm that the plugin are activated in both areas: - Joomla plugin area - JCB global options Like this: > Joomla plugin area ![image](https://git.vdm.dev/attachments/e9478d1e-5b53-4cea-861f-4913906a96a4) > JCB global options ![image](https://git.vdm.dev/attachments/13764464-ca84-4094-b4cf-e1159aa02839) Since I have found that JCB does not add the classes when the `Extension - Componentbuilder Powers Autoloader Compiler` or the `Extension - Componentbuilder Headers Compiler` plugin is inactive.
128 KiB
156 KiB
Author

I noted that my Active Complier Plugins had more extensions than what you had displayed: Extension - Componentbuilder Export Complier and Extension - Componentbuilder Language Package and Extension - Joomla

I removed those and tried to compile my component. It came back with the same error.

Thank you for all your efforts.

I noted that my Active Complier Plugins had more extensions than what you had displayed: `Extension - Componentbuilder Export Complier` and `Extension - Componentbuilder Language Package` and `Extension - Joomla` I removed those and tried to compile my component. It came back with the same error. Thank you for all your efforts.
Owner

Hmmm I assumed this would not be the case, but... you do have add power set to yes right?

There is two places this can be set:

  • In the component
    image
  • In the compiler dashboard
    image

Should you select global then it will use the component settings, else it will use what you choose.

The purpose of this, is to avoid adding powers to components when other components of the same website already has those powers.

Hmmm I assumed this would not be the case, but... you do have add power set to yes right? There is two places this can be set: - In the component ![image](https://git.vdm.dev/attachments/c60373ee-b570-41f6-a110-fe82c6fe691b) - In the compiler dashboard ![image](https://git.vdm.dev/attachments/d83580fa-44b1-4c3a-a637-43453f257043) Should you select global then it will use the **component settings**, else it will use what you choose. The purpose of this, is to avoid adding powers to components when other components of the same website already has those powers.
Author

This is the only component that I write and I have the powers set to Yes on the component settings and global when I compile.

This is the only component that I write and I have the powers set to Yes on the component settings and global when I compile.
Owner

do me a favor and add the following to your component helpers area:

// Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power

SO that it looks like this:

image

Then compile and let me know if the issue continues.

do me a favor and add the following to your component helpers area: ``` // Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power ``` SO that it looks like this: ![image](https://git.vdm.dev/attachments/7715f682-3d47-4ced-b230-f18b7d6bca15) Then compile and let me know if the issue continues.
Owner

I have updated the component package to version 3.1.27 and this issue should be resolved now, if not please bump this issue and we will reopen it. Enjoy!

I have updated the [component package to version 3.1.27](https://git.vdm.dev/joomla/pkg-component-builder/releases/tag/v3.1.27) and this issue should be resolved now, if not please bump this issue and we will reopen it. Enjoy!
Author

I'm sorry for the delay, this is my side hustle, I've been working my real job. I have a new but related problem after upgrading to 3.1.27: Screenshot 2023-10-22 at 10.36.33 PM.png

I have tried a few things. I compiled more than once. I tried removing the powers and letting them re-load from scratch. That intervention resulted in this same error.

I also tried to comment out the power of this power and compile, which resulted in each site view for my component on the front end loading a blank white page. I can see the powers loading in the component: Screenshot 2023-10-22 at 10.42.28 PM.png

I'm sorry for the delay, this is my side hustle, I've been working my real job. I have a new but related problem after upgrading to 3.1.27: ![Screenshot 2023-10-22 at 10.36.33 PM.png](/attachments/e41e80ac-de66-4e07-8e12-d48f3a19892e) I have tried a few things. I compiled more than once. I tried removing the powers and letting them re-load from scratch. That intervention resulted in this same error. I also tried to comment out the power of this power and compile, which resulted in each site view for my component on the front end loading a blank white page. I can see the powers loading in the component: ![Screenshot 2023-10-22 at 10.42.28 PM.png](/attachments/c966b881-e29d-4b16-a49e-45069e55c69d)
znorm87 reopened this issue 2023-10-23 03:43:01 +00:00
Owner

So let me ques your using some kind of encryption setting (basic|medium) on a field in your component. (just to confirm why these classes are loading.

To be fair this is really a new issue, that is related to the migration to fof/AES powers which is needed going to Joomla 4.

Which is honestly a massive pain to say the least, see the depreciation notice:

This was ported for the sake of those who have stuff encrypted with the FOF encryption suite.
                  - Do not use this in new projects.
                  - Expect no updates.
                  - This is outdated.
                  - Not best choice for encryption.
                  - Use phpseclib/phpseclib version 3 Instead.
                  - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib>

We also added a new message in the GUI:
image
image

So yes there is not easy migration path at this time.

What we are trying to do is extend the inevitable nightmare of decrypting each value en re-encryption of each value for all those who used these features.

So the port should load via the spl_autoload_register that is added to your components entry point, and helper class as explained above. This should look something like this:

// register this component namespace
spl_autoload_register(function ($class) {
	// project-specific base directories and namespace prefix
	$search = [
		'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
		'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla'
	];
	// Start the search and load if found
	$found = false;
	$found_base_dir = "";
	$found_len = 0;
	foreach ($search as $base_dir => $prefix)
	{
		// does the class use the namespace prefix?
		$len = strlen($prefix);
		if (strncmp($prefix, $class, $len) === 0)
		{
			// we have a match so load the values
			$found = true;
			$found_base_dir = $base_dir;
			$found_len = $len;
			// done here
			break;
		}
	}
	// check if we found a match
	if (!$found)
	{
		// not found so move to the next registered autoloader
		return;
	}
	// get the relative class name
	$relative_class = substr($class, $found_len);
	// replace the namespace prefix with the base directory, replace namespace
	// separators with directory separators in the relative class name, append
	// with .php
	$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
	// if the file exists, require it
	if (file_exists($file))
	{
		require $file;
	}
});

This is the critical part you should see:

'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF'

Then in the file where these fields are stored and retrieved there should be a use statement like this: use VDM\Joomla\FOF\Encrypt\AES;

Please confirm if this is the case, since this is done automatically via the new supper powers area.

Edge-case solutions:

If you are calling your module classes from outside your component, like a module or plugin, then you will have to add the following placeholder in the header of the class making the call: ###ADMIN_POWER_HELPER###

This will the add the autoloader to that class as well...

You can also add the autoloader to a plugin (in JCB) like this:

/**
 * Application object
 *
 * @var    CMSApplication
 * @since  1.0.0
 */
protected  $app;

/**
 * Affects constructor behavior. If true, language files will be loaded automatically.
 *
 * @var    boolean
 * @since  1.0.0
 */
protected  $autoloadLanguage = false;

/**
 * Constructor.
 *
 * @param   object  &$subject  The object to observe -- event dispatcher.
 * @param   object  $config    An optional associative array of configuration settings.
 *
 * @since   1.6
 */
public function __construct($subject, $config)
{
	parent::__construct($subject, $config);###PLUGIN_POWER_AUTOLOADER###
}

Make sure the plugin is set as a systems plugin, and loaded first.
image

I have tried to manage this as best I can, let me know what you can see. I have fixed a few more issues and will push out a new release soon. Issues related to the powers area, as this is a critical part of the path forward.

So let me ques your using some kind of encryption setting (basic|medium) on a field in your component. (just to confirm why these classes are loading. To be fair this is really a new issue, that is related to the migration to fof/AES **powers** which is needed going to Joomla 4. Which is honestly a massive pain to say the least, see the [depreciation](https://git.vdm.dev/joomla/fof/src/branch/master/src/99175f6d-dba8-4086-8a65-5c4ec175e61d/code.php#L8) notice: ``` This was ported for the sake of those who have stuff encrypted with the FOF encryption suite. - Do not use this in new projects. - Expect no updates. - This is outdated. - Not best choice for encryption. - Use phpseclib/phpseclib version 3 Instead. - Checkout the JCB Crypt Suite. <https://git.vdm.dev/joomla/phpseclib> ``` We also added a new message in the GUI: ![image](https://git.vdm.dev/attachments/6ef797a3-8e74-494c-910f-697fce88a533) ![image](https://git.vdm.dev/attachments/a4721ac2-3717-4378-836b-d4e53ea82349) So yes there is not easy migration path at this time. What we are trying to do is extend the inevitable nightmare of decrypting each value en re-encryption of each value for all those who used these features. So the port should load via the `spl_autoload_register` that is added to your components entry point, and helper class as explained above. This should look something like this: ``` // register this component namespace spl_autoload_register(function ($class) { // project-specific base directories and namespace prefix $search = [ 'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF', 'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla' ]; // Start the search and load if found $found = false; $found_base_dir = ""; $found_len = 0; foreach ($search as $base_dir => $prefix) { // does the class use the namespace prefix? $len = strlen($prefix); if (strncmp($prefix, $class, $len) === 0) { // we have a match so load the values $found = true; $found_base_dir = $base_dir; $found_len = $len; // done here break; } } // check if we found a match if (!$found) { // not found so move to the next registered autoloader return; } // get the relative class name $relative_class = substr($class, $found_len); // replace the namespace prefix with the base directory, replace namespace // separators with directory separators in the relative class name, append // with .php $file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; // if the file exists, require it if (file_exists($file)) { require $file; } }); ``` This is the critical part you should see: ``` 'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF' ``` Then in the file where these fields are stored and retrieved there should be a **use** statement like this: `use VDM\Joomla\FOF\Encrypt\AES;` Please confirm if this is the case, since this is done automatically via the new supper powers area. > Edge-case solutions: If you are calling your module classes from outside your component, like a module or plugin, then you will have to add the following placeholder in the header of the class making the call: `###ADMIN_POWER_HELPER###` This will the add the autoloader to that class as well... You can also add the autoloader to a plugin (in JCB) like this: ``` /** * Application object * * @var CMSApplication * @since 1.0.0 */ protected $app; /** * Affects constructor behavior. If true, language files will be loaded automatically. * * @var boolean * @since 1.0.0 */ protected $autoloadLanguage = false; /** * Constructor. * * @param object &$subject The object to observe -- event dispatcher. * @param object $config An optional associative array of configuration settings. * * @since 1.6 */ public function __construct($subject, $config) { parent::__construct($subject, $config);###PLUGIN_POWER_AUTOLOADER### } ``` Make sure the plugin is set as a systems plugin, and loaded first. ![image](https://git.vdm.dev/attachments/a162b190-23ef-428c-82d2-1b3f14b07dc1) I have tried to manage this as best I can, let me know what you can see. I have fixed a few more issues and will push out a new release soon. Issues related to the powers area, as this is a critical part of the path forward.
Owner

JCB is part of my real job 😉

JCB is part of my real job 😉
Author

Yes, I do have basic encryption set-up for a number of fields. I had not noticed the deprecation notices but now I know...

So let me ques your using some kind of encryption setting (basic|medium) on a field in your component. (just to confirm why these classes are loading.

To be fair this is really a new issue, that is related to the migration to fof/AES powers which is needed going to Joomla 4.

I can find all the code that you describe below however still end up with the error on a SiteView on the Frontend. The Backend admin views all work just fine. My component is mostly built to be a frontend component though.

So the port should load via the spl_autoload_register that is added to your components entry point, and helper class as explained above. This should look something like this:

// register this component namespace
spl_autoload_register(function ($class) {
	// project-specific base directories and namespace prefix
	$search = [
		'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF',
		'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla'
	];
	// Start the search and load if found
	$found = false;
	$found_base_dir = "";
	$found_len = 0;
	foreach ($search as $base_dir => $prefix)
	{
		// does the class use the namespace prefix?
		$len = strlen($prefix);
		if (strncmp($prefix, $class, $len) === 0)
		{
			// we have a match so load the values
			$found = true;
			$found_base_dir = $base_dir;
			$found_len = $len;
			// done here
			break;
		}
	}
	// check if we found a match
	if (!$found)
	{
		// not found so move to the next registered autoloader
		return;
	}
	// get the relative class name
	$relative_class = substr($class, $found_len);
	// replace the namespace prefix with the base directory, replace namespace
	// separators with directory separators in the relative class name, append
	// with .php
	$file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
	// if the file exists, require it
	if (file_exists($file))
	{
		require $file;
	}
});

This is the critical part you should see:

'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF'

Then in the file where these fields are stored and retrieved there should be a use statement like this: use VDM\Joomla\FOF\Encrypt\AES;

Please confirm if this is the case, since this is done automatically via the new supper powers area.

I'm not calling from outside the component.

If you are calling your module classes from outside your component, like a module or plugin, then you will have to add the following placeholder in the header of the class making the call: ###ADMIN_POWER_HELPER###

Yes, I do have basic encryption set-up for a number of fields. I had not noticed the deprecation notices but now I know... > So let me ques your using some kind of encryption setting (basic|medium) on a field in your component. (just to confirm why these classes are loading. > > To be fair this is really a new issue, that is related to the migration to fof/AES **powers** which is needed going to Joomla 4. I can find all the code that you describe below however still end up with the error on a SiteView on the Frontend. The Backend admin views all work just fine. My component is mostly built to be a frontend component though. > So the port should load via the `spl_autoload_register` that is added to your components entry point, and helper class as explained above. This should look something like this: > ``` > // register this component namespace > spl_autoload_register(function ($class) { > // project-specific base directories and namespace prefix > $search = [ > 'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF', > 'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla' > ]; > // Start the search and load if found > $found = false; > $found_base_dir = ""; > $found_len = 0; > foreach ($search as $base_dir => $prefix) > { > // does the class use the namespace prefix? > $len = strlen($prefix); > if (strncmp($prefix, $class, $len) === 0) > { > // we have a match so load the values > $found = true; > $found_base_dir = $base_dir; > $found_len = $len; > // done here > break; > } > } > // check if we found a match > if (!$found) > { > // not found so move to the next registered autoloader > return; > } > // get the relative class name > $relative_class = substr($class, $found_len); > // replace the namespace prefix with the base directory, replace namespace > // separators with directory separators in the relative class name, append > // with .php > $file = JPATH_ROOT . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php'; > // if the file exists, require it > if (file_exists($file)) > { > require $file; > } > }); > ``` > > This is the critical part you should see: > ``` > 'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF' > ``` > > Then in the file where these fields are stored and retrieved there should be a **use** statement like this: `use VDM\Joomla\FOF\Encrypt\AES;` > > Please confirm if this is the case, since this is done automatically via the new supper powers area. I'm not calling from outside the component. > If you are calling your module classes from outside your component, like a module or plugin, then you will have to add the following placeholder in the header of the class making the call: `###ADMIN_POWER_HELPER###`
Owner

The site view are should also have the spl_autoload_register in the component entry point like the admin area does.

Can you confirm this?

If this is true, then we need to start looking at custom code. We should also look at the module your using to load the data in this site view. The same use statements should be found in these areas as in the back-end where these encryption fields are being used.

I can't see your component, and so unless you debug things on your side and show me what is missing, how will I know?

The site view are should also have the `spl_autoload_register` in the component entry point like the admin area does. Can you confirm this? If this is true, then we need to start looking at custom code. We should also look at the module your using to load the data in this site view. The same `use` statements should be found in these areas as in the back-end where these encryption fields are being used. I can't see your component, and so unless you debug things on your side and show me what is missing, how will I know?
Author

After digging deep and upgrading to 3.1.28 in both the site and admin side in the helper/learning.php (my component is com_learning)

the line:
'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\Joomla\FOF',

is missing:

spl_autoload_register(function ($class) {
	// [VDM\Joomla\Componentbuilder\Compiler\Power\Autoloader 288] project-specific base directories and namespace prefix
	$search = [
		'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla'
	]; ....

When I add it back, everything works well!

After digging deep and upgrading to 3.1.28 in both the site and admin side in the helper/learning.php (my component is com_learning) the line: 'libraries/jcb_powers/VDM.Joomla.FOF' => 'VDM\\Joomla\\FOF', is missing: ``` spl_autoload_register(function ($class) { // [VDM\Joomla\Componentbuilder\Compiler\Power\Autoloader 288] project-specific base directories and namespace prefix $search = [ 'libraries/jcb_powers/VDM.Joomla' => 'VDM\\Joomla' ]; .... ``` When I add it back, everything works well!
Owner

Okay, it seems like we have an event issue, I have now tried to fix this, but it will need more work in the future.

To test please try the beta version: https://git.vdm.dev/joomla-beta/pkg-component-builder/archive/master.zip

Okay, it seems like we have an event issue, I have now tried to fix this, but it will need more work in the future. To test please try the beta version: https://git.vdm.dev/joomla-beta/pkg-component-builder/archive/master.zip
Author

Beta works perfectly!

Beta works perfectly!
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1014
No description provided.