[BUG]: renderFieldset() in Compiler View if there is no component to compile #1263

Closed
opened 2025-10-16 19:55:38 +00:00 by oxido · 3 comments

What Happened?

If you delete or unpublish all the components available in JCB 5.1.2 and you access the compiler after (I know, there is no reason to do that, but I did it :)) ), this error showed up:
Call to a member function renderFieldset() on null

Steps to reproduce the Bug

  1. In JCB go to Joomla Components Delete or Unpublish all the components
  2. Go to Compilere.

Which Joomla version are you compiling in?

v5.3.3

Which PHP version are you compiling in?

v8.2

Which Joomla versions are you targeting?

v5.x

Which PHP version are you targeting?

8.x

Which Web server is JCB running on?

Apache/2.4.62 (Debian)

Which Relational Database is JCB running on?

Mysql, 11.6.2-MariaDB-ubu2404

Which OS is JCB running on?

Ubuntu

Which JCB version are you using?

v5.1.2

Where in JCB did this issue occur?

Compiler(admin_view)

On which browsers did you encounter the issue?

Firefox

Additional Comments

No response

### What Happened? If you delete or unpublish all the components available in JCB 5.1.2 and you access the compiler after (I know, there is no reason to do that, but I did it :)) ), this error showed up: `Call to a member function renderFieldset() on null ` ### Steps to reproduce the Bug 1. In JCB go to Joomla Components Delete or Unpublish all the components 2. Go to Compilere. ### Which Joomla version are you compiling in? v5.3.3 ### Which PHP version are you compiling in? v8.2 ### Which Joomla versions are you targeting? v5.x ### Which PHP version are you targeting? 8.x ### Which Web server is JCB running on? Apache/2.4.62 (Debian) ### Which Relational Database is JCB running on? Mysql, 11.6.2-MariaDB-ubu2404 ### Which OS is JCB running on? Ubuntu ### Which JCB version are you using? v5.1.2 ### Where in JCB did this issue occur? Compiler(admin_view) ### On which browsers did you encounter the issue? Firefox ### Additional Comments _No response_
oxido added the Bug label 2025-10-16 19:55:38 +00:00
Owner

This has been raised in the past here #1164.
Let us know if you have a fix for this. Any contribution will be welcome.

This has been raised in the past here #1164. Let us know if you have a fix for this. Any contribution will be welcome.
Member

Would adding this else statement to the file be sufficient? This should solve any solve any issues with fieldsets not being rendered.

public function getDynamicForm(): ?Form
{
if(ArrayHelper::check($this->Components))
{

else {
// start the form
			$form = new Form('Builder');

			$form->load('<form
				addruleprefix="VDM\Component\Componentbuilder\Administrator\Rule"
				addfieldprefix="VDM\Component\Componentbuilder\Administrator\Field">
					<config><inlinehelp button="show"/></config>
					<fieldset name="builder"></fieldset>
					<fieldset name="advanced"></fieldset></form>');

			// No components found
			$attributes = [
				'type' => 'note',
				'name' => 'nocomponentnote',
				'label' => 'COM_COMPONENTBUILDER_NO_COMPONENT_NOTE_LABEL',
				'description' => 'COM_COMPONENTBUILDER_NO_COMPONENT_NOTE_DESCRIPTION'
				];

			// add to form
			$xml = FormHelper::xml($attributes, $options);
			if ($xml instanceof \SimpleXMLElement)
			{
				$form->setField($xml, null, true, 'builder');
			}

}

Would adding this else statement to the file be sufficient? This should solve any solve any issues with fieldsets not being rendered. https://git.vdm.dev/joomla/Component-Builder/src/commit/2fab51f611ca004245a8c96ec249e5e587c9c3c5/admin/src/View/Compiler/HtmlView.php#L174-L177 ``` else { // start the form $form = new Form('Builder'); $form->load('<form addruleprefix="VDM\Component\Componentbuilder\Administrator\Rule" addfieldprefix="VDM\Component\Componentbuilder\Administrator\Field"> <config><inlinehelp button="show"/></config> <fieldset name="builder"></fieldset> <fieldset name="advanced"></fieldset></form>'); // No components found $attributes = [ 'type' => 'note', 'name' => 'nocomponentnote', 'label' => 'COM_COMPONENTBUILDER_NO_COMPONENT_NOTE_LABEL', 'description' => 'COM_COMPONENTBUILDER_NO_COMPONENT_NOTE_DESCRIPTION' ]; // add to form $xml = FormHelper::xml($attributes, $options); if ($xml instanceof \SimpleXMLElement) { $form->setField($xml, null, true, 'builder'); } } ```
Owner

We added a no component template 👍 I have never used JCB empty... so I never bothered.

We are rushing out a next stable release, for V5 and V6 to address some urgent bugs and security fixes, so we will add this to it 😉 (for fun)

We added a `no component template` 👍 I have never used JCB empty... so I never bothered. We are rushing out a next stable release, for V5 and V6 to address some urgent bugs and security fixes, so we will add this to it 😉 (for fun)
Robot referenced this issue from a commit 2025-10-17 18:55:57 +00:00
Robot referenced this issue from a commit 2025-10-17 18:59:35 +00:00
oxido closed this issue 2025-10-17 20:17:39 +00:00
Sign in to join this conversation.
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1263