[BUG]: Errors When Saving Component View #1170

Open
opened 2024-09-08 00:47:09 +00:00 by mwweb · 8 comments

What Happened?

On my localhost I upgraded JCB to the latest alpha release, and latest Joomla! 3.x release. I then upgraded Joomla to J!4.0.0, 4.0.4, then Joomla 4.3.3. Lastly, I upgraded to Joomla 5.1.4, and upgraded JCB to 5.0.3-alpha3.

All appeared to be fine, but upon trying to save a component I am getting a series of message:

Save failed with the following error: Data truncated for column 'not_required' at row 1

Save failed with the following error: Incorrect integer value: '' for column dev.j_componentbuilder_joomla_component.add_backup_folder_path at row 1

For the first error, it looks like even though Add Update Server, under the Dynamic Integration tab, is set to No, that error is being thrown. If I change to Yes, then the Data truncated error clears, and the error changes to the second error. Even though I have the backup folder path, and the git folder path set in JCB Options, I getting this error. If I override, and set something, then the error changes to:

Save failed with the following error: Incorrect integer value: 'update_server_target,buildcompsql,crowdin_project_api_key,crowdin_project_identifier,crowdin_username' for column dev.j_componentbuilder_joomla_component.not_required at row 1

Translation Tool is set to None, but is requiring that information to be filled.

Steps to reproduce the Bug

On my localhost I upgraded JCB to the latest alpha release, and latest Joomla! 3.x release. I then upgraded Joomla to J!4.0.0, 4.0.4, then Joomla 4.3.3. Lastly, I upgraded to Joomla 5.1.4, and upgraded JCB to 5.0.3-alpha3.

Which Joomla version are you compiling in?

5.1.4

Which PHP version are you compiling in?

8.2.21

Which Joomla versions are you targeting?

5.x

Which PHP version are you targeting?

8.2

Which Web server is JCB running on?

Apache/2.4.61 (Debian)

Which Relational Database is JCB running on?

11.4.2-MariaDB-ubu2404

Which OS is JCB running on?

Ubuntu 22.04.4 LTS

Which JCB version are you using?

v5.0.3-alpha3

Where in JCB did this issue occur?

Joomla Component(admin_view)

On which browsers did you encounter the issue?

Firefox

Additional Comments

Localhost was setup using OctoJoom.

### What Happened? On my localhost I upgraded JCB to the latest alpha release, and latest Joomla! 3.x release. I then upgraded Joomla to J!4.0.0, 4.0.4, then Joomla 4.3.3. Lastly, I upgraded to Joomla 5.1.4, and upgraded JCB to 5.0.3-alpha3. All appeared to be fine, but upon trying to save a component I am getting a series of message: Save failed with the following error: Data truncated for column 'not_required' at row 1 Save failed with the following error: Incorrect integer value: '' for column `dev`.`j_componentbuilder_joomla_component`.`add_backup_folder_path` at row 1 For the first error, it looks like even though Add Update Server, under the Dynamic Integration tab, is set to No, that error is being thrown. If I change to Yes, then the Data truncated error clears, and the error changes to the second error. Even though I have the backup folder path, and the git folder path set in JCB Options, I getting this error. If I override, and set something, then the error changes to: Save failed with the following error: Incorrect integer value: 'update_server_target,buildcompsql,crowdin_project_api_key,crowdin_project_identifier,crowdin_username' for column `dev`.`j_componentbuilder_joomla_component`.`not_required` at row 1 Translation Tool is set to None, but is requiring that information to be filled. ### Steps to reproduce the Bug On my localhost I upgraded JCB to the latest alpha release, and latest Joomla! 3.x release. I then upgraded Joomla to J!4.0.0, 4.0.4, then Joomla 4.3.3. Lastly, I upgraded to Joomla 5.1.4, and upgraded JCB to 5.0.3-alpha3. ### Which Joomla version are you compiling in? 5.1.4 ### Which PHP version are you compiling in? 8.2.21 ### Which Joomla versions are you targeting? 5.x ### Which PHP version are you targeting? 8.2 ### Which Web server is JCB running on? Apache/2.4.61 (Debian) ### Which Relational Database is JCB running on? 11.4.2-MariaDB-ubu2404 ### Which OS is JCB running on? Ubuntu 22.04.4 LTS ### Which JCB version are you using? v5.0.3-alpha3 ### Where in JCB did this issue occur? Joomla Component(admin_view) ### On which browsers did you encounter the issue? Firefox ### Additional Comments Localhost was setup using OctoJoom.
mwweb added the
Bug
label 2024-09-08 00:47:09 +00:00
mwweb changed title from [BUG]: to [BUG]: Errors When Saving Component View 2024-09-08 20:28:44 +00:00
Author

I went back to my old localhost, and I'm testing every step of the upgrade process to see if I can find WHERE the breakdown might be. I'll update this as I find issues.

  • I started with Joomla 3.10.12, running JCB 3.1.28, which everything was working well on.
  • I upgraded JCB to 3.2.0 and saw no obvious issues
  • I upgraded to JCB 3.2.1 and again saw no obvious issue
  • Upgrade to JCB 3.2.2 generated a warning on install: Error: updating database schema. Error: failed to create missing joomla_power table. Key column 'id' doesn't exist in table.

In looking at the Update SQL, All of the files are blank.

So, it looks like 3.2.1 didn't have the CREATE IF NOT EXIST in update SQL to create that new table.

There's also an error in the dumped data: 1366 - Incorrect integer value: '' for column dev.j_componentbuilder_joomla_power.hits at row 1

More to come...

I went back to my old localhost, and I'm testing every step of the upgrade process to see if I can find WHERE the breakdown might be. I'll update this as I find issues. - I started with Joomla 3.10.12, running JCB 3.1.28, which everything was working well on. - I upgraded JCB to 3.2.0 and saw no obvious issues - I upgraded to JCB 3.2.1 and again saw no obvious issue - Upgrade to JCB 3.2.2 generated a warning on install: Error: updating database schema. Error: failed to create missing joomla_power table. Key column 'id' doesn't exist in table. In looking at the Update SQL, All of the files are blank. So, it looks like 3.2.1 didn't have the CREATE IF NOT EXIST in update SQL to create that new table. There's also an error in the dumped data: 1366 - Incorrect integer value: '' for column `dev`.`j_componentbuilder_joomla_power`.`hits` at row 1 More to come...
Author
  • 3.2.2 threw an syntax error, unexpected '('
  • 3.2.3 threw the same syntax error.

It looks like from 3.2.1 to 3.2.2 there were some changes to the vendor_jcb/VDM.Joomla.

- 3.2.2 threw an syntax error, unexpected '(' - 3.2.3 threw the same syntax error. It looks like from 3.2.1 to 3.2.2 there were some changes to the vendor_jcb/VDM.Joomla.
Author

Running Joomla 3.10.12
JCB 3.2.1 installed
Upgrade to Joomla 4.4.8
Install JCB 4.0.0

Don't get the syntax error, unexpected '(', but do get the original Data truncated for column 'not_required' at row 1

In further testing, this doesn't happen on a brand new install of J!3.10.12 and JCB 3.2.1, then upgrading.

My speculation, then, would be that since I've been using JCB for YEARS, perhaps something changed at some point, and the schema wasn't being checked.

Running Joomla 3.10.12 JCB 3.2.1 installed Upgrade to Joomla 4.4.8 Install JCB 4.0.0 Don't get the syntax error, unexpected '(', but do get the original Data truncated for column 'not_required' at row 1 In further testing, this doesn't happen on a brand new install of J!3.10.12 and JCB 3.2.1, then upgrading. My speculation, then, would be that since I've been using JCB for YEARS, perhaps something changed at some point, and the schema wasn't being checked.
Owner

Thank you for the detailed feedback and the steps you've outlined regarding the issue. I think you're right in your assessment, and it does appear that the not_required column might be the root cause of the problem here. Based on what you're describing, it seems that some legacy fields, such as not_required, which we previously used for server-side validation, were removed during the evolution of JCB's schema. This was intentional, as the field had no longer served a meaningful role in the actual data structure, and removing it helped streamline things in newer versions of JCB.

To address your concerns more directly:

We added a schema engine to JCB specifically to ensure that new fields and existing ones stay in sync across various Joomla installations. This allows for automated updates of tables, fields, and data types. The reason we moved away from Joomla’s default MySQL update method is that JCB is now used across multiple versions and instances of Joomla, making it necessary to handle schema updates in a more controlled and flexible way.

I’ve personally spent a significant amount of time developing and refining this new schema engine to manage these scenarios. However, based on your report, it seems like there may be lingering fields (such as not_required) that the new schema engine isn't handling correctly, especially if they are present in legacy data but have been removed from the newer schema.

From what I can see, the error regarding "Data truncated for column 'not_required'" suggests that the system is still trying to interact with a field that should no longer exist. Given that this column was removed, manually removing it and reinstalling JCB could resolve the issue, as this would force JCB to resync the schema and skip the now-irrelevant field.

Regarding the second error (Incorrect integer value: '' for column dev.j_componentbuilder_joomla_component.add_backup_folder_path at row 1), this might be related to the fact that certain columns are not getting the correct default values when empty. It's possible that some configuration fields aren’t being set correctly during the update or validation processes. We’ll need to investigate further to determine why the new schema engine isn’t updating these columns as expected.

In summary, I think the best course of action would be to try removing the problematic not_required field, then reinstall JCB, allowing the schema engine to refresh the database structure. If that doesn’t resolve it, I’ll dive deeper into the schema engine to see if it needs further adjustments to handle these legacy fields properly.

Please keep me updated on your progress with the uninstall/reinstall approach, and I’ll continue looking into potential improvements for this scenario.

Thank you for the detailed feedback and the steps you've outlined regarding the issue. I think you're right in your assessment, and it does appear that the `not_required` column might be the root cause of the problem here. Based on what you're describing, it seems that some legacy fields, such as `not_required`, which we previously used for server-side validation, were removed during the evolution of JCB's schema. This was intentional, as the field had no longer served a meaningful role in the actual data structure, and removing it helped streamline things in newer versions of JCB. To address your concerns more directly: We added a schema engine to JCB specifically to ensure that new fields and existing ones stay in sync across various Joomla installations. This allows for automated updates of tables, fields, and data types. The reason we moved away from Joomla’s default MySQL update method is that JCB is now used across multiple versions and instances of Joomla, making it necessary to handle schema updates in a more controlled and flexible way. I’ve personally spent a significant amount of time developing and refining this new schema engine to manage these scenarios. However, based on your report, it seems like there may be lingering fields (such as `not_required`) that the new schema engine isn't handling correctly, especially if they are present in legacy data but have been removed from the newer schema. From what I can see, the error regarding "Data truncated for column 'not_required'" suggests that the system is still trying to interact with a field that should no longer exist. Given that this column was removed, manually removing it and reinstalling JCB could resolve the issue, as this would force JCB to resync the schema and skip the now-irrelevant field. Regarding the second error (`Incorrect integer value: '' for column dev.j_componentbuilder_joomla_component.add_backup_folder_path at row 1`), this might be related to the fact that certain columns are not getting the correct default values when empty. It's possible that some configuration fields aren’t being set correctly during the update or validation processes. We’ll need to investigate further to determine why the new schema engine isn’t updating these columns as expected. In summary, I think the best course of action would be to try removing the problematic `not_required` field, then reinstall JCB, allowing the schema engine to refresh the database structure. If that doesn’t resolve it, I’ll dive deeper into the schema engine to see if it needs further adjustments to handle these legacy fields properly. Please keep me updated on your progress with the uninstall/reinstall approach, and I’ll continue looking into potential improvements for this scenario.
Owner

Here is the current Table class used in the Schema update. Looking over this huge array... will show you what must be there and what we removed, JCB dynamically builds this class, if you use this Super Power for any component. The table class extent a base-table class that has all the default fields, so this table class only focus on the field we add to the views in JCB.

Here is the [current Table class](https://git.vdm.dev/joomla/Component-Builder/src/commit/fc8fabe298ea188207ad4d9538931b10c031902f/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Table.php#L32) used in the Schema update. Looking over this huge array... will show you what must be there and what we removed, JCB dynamically builds this class, if you use this [Super Power](https://git.vdm.dev/joomla/super-powers/src/branch/master/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8) for any component. The table class extent a base-table class that has all the default fields, so this table class only focus on the field we add to the views in JCB.
Author

I was assuming that it was the field as the likely culprit, but wanted to find out before dropping the field.

I dripped the field, and that resolved the errors when saving a component. It's late tonight, but I will continue my upgrade path, then test some compiling and installing.

Once I get this all upgraded on my a windows localhost, I'll then back up and restore on my Octojoom site for the testing.

I was assuming that it was the field as the likely culprit, but wanted to find out before dropping the field. I dripped the field, and that resolved the errors when saving a component. It's late tonight, but I will continue my upgrade path, then test some compiling and installing. Once I get this all upgraded on my a windows localhost, I'll then back up and restore on my Octojoom site for the testing.
Author

It's been a long process, but I have JCB 5.0.0 installed on Joomla 5.1.4. Compile is having an issue, but I'm thinking that the schema. I'll have to dig into it tomorrow.

1364 Field 'modules' doesn't have a default value

It's been a long process, but I have JCB 5.0.0 installed on Joomla 5.1.4. Compile is having an issue, but I'm thinking that the schema. I'll have to dig into it tomorrow. 1364 Field 'modules' doesn't have a default value
Author

Still digging into the error, but I will post it here too, in case it is another issue of some code being incorrect or missing.

It looks like it's related to the #__componentbuilder_language_translation table.

So far,

"modules" TEXT NULL, "plugins" TEXT NULL, "translation" TEXT NULL "params" TEXT NULL,
both are NOT NULL in the old DB structure. Manually changed to NULL, and error resolved and compiled. Compiling Hello World, installing, and attempting to opened creates a whole different issue: Invalid controller class: display

Still digging into the error, but I will post it here too, in case it is another issue of some code being incorrect or missing. It looks like it's related to the #__componentbuilder_language_translation table. So far, ` "modules" TEXT NULL, "plugins" TEXT NULL, "translation" TEXT NULL "params" TEXT NULL, ` both are NOT NULL in the old DB structure. Manually changed to NULL, and error resolved and compiled. Compiling Hello World, installing, and attempting to opened creates a whole different issue: Invalid controller class: display
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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#1170
No description provided.