[BUG]: Errors When Saving Component View #1170
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#1170
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 1For 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 1Translation 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.
[BUG]:to [BUG]: Errors When Saving Component ViewI 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.
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 1More to come...
It looks like from 3.2.1 to 3.2.2 there were some changes to the vendor_jcb/VDM.Joomla.
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.
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 asnot_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.
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.
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.
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
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
Has the stable release help solve this, we have improved the Schema class fairly much.
I'll try rebuilding everything again, and see if this resolves the issue. I did a lot of manual updates, and have it working, for the most part.
However, I did just upgrade JCB from 5.0.0 to 5.0.3 and received the attached warning:
I'm starting upgrading from J! 3,10.12, JCB 3.1.28. I'll update the process here.
Warning
Error: updating database schema. Error: failed to create missing joomla_power table. Invalid default value for 'id'
Instead of upgrading, I'll trying installing a new version over my Joomla 5 install that I spent hours on.
Updating JCB to 5.0.3 didn't do anything that I saw.
I was continuing to received data truncated on 'not_required'
Looking through that DB from JCB 3.x, there are some tables that had a not_required column. Once I dropped those columns, JCB is allowing me to save fields, dynamic gets, etc with no errors.
I am still receiving that unknown column placeholders in field list when attempting to compile. Please see attached.
Here are the JCB tables that included the not _required column causing the errors.
admin_view
component_updates
dynamic_get
field
language_translation
snippet
One thing that might help is manually making sure that your DB columns in your system lineup with the DB columns in the setup file of the JCB DB.
To basically remove all columns that are no longer needed, and to update any data-types and NULL settings.
JCB will update existing columns and tables, but those where the column has been removed, we don't currently remove them.... I am not sure if this is the case here, I have not had time to investigate it. But I suspect this might be the case.