[BUG]: Compiler error: Updatesql::add(): Argument #2 ($item) must be of type int, string given #1209

Open
opened 2025-02-25 19:13:57 +00:00 by Marco Aldana · 9 comments
Member

What Happened?

When Adding new admin views to component, or new Fields to view then compiling, gives error when updating the SQL of the component

Steps to reproduce the Bug

Compile an existing Component and Install it
Add a new admin view to the component or Add new field to Admin view
Compile

An error has occurred.

0 VDM\Joomla\Componentbuilder\Compiler\Model\Updatesql::add(): Argument #2 ($item) must be of type int, string given, called in /var/www/html/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Updatesql.php on line 189 

Call Stack

Function Location

1 () JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Updatesql.php:213
2 VDM\Joomla\Componentbuilder\Compiler\Model\Updatesql->add() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Updatesql.php:189
3 VDM\Joomla\Componentbuilder\Compiler\Model\Updatesql->set() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Fields.php:200
4 VDM\Joomla\Componentbuilder\Compiler\Model\Fields->set() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Adminview/Data.php:518
5 VDM\Joomla\Componentbuilder\Compiler\Adminview\Data->getData() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Adminview/Data.php:356
6 VDM\Joomla\Componentbuilder\Compiler\Adminview\Data->set() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Adminview/Data.php:325
7 VDM\Joomla\Componentbuilder\Compiler\Adminview\Data->get() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Adminviews.php:167
8 VDM\Joomla\Componentbuilder\Compiler\Model\Adminviews->VDM\Joomla\Componentbuilder\Compiler\Model{closure}()
9 array_map() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Adminviews.php:121
10 VDM\Joomla\Componentbuilder\Compiler\Model\Adminviews->set() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component/Data.php:631
11 VDM\Joomla\Componentbuilder\Compiler\Component\Data->setViews() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component/Data.php:444
12 VDM\Joomla\Componentbuilder\Compiler\Component\Data->energize() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component/Data.php:320
13 VDM\Joomla\Componentbuilder\Compiler\Component\Data->get() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component.php:38
14 VDM\Joomla\Componentbuilder\Compiler\Component->__construct() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/Component.php:99
15 VDM\Joomla\Componentbuilder\Compiler\Service\Component->getCompilerComponent() JROOT/libraries/vendor/joomla/di/src/ContainerResource.php:166
16 Joomla\DI\ContainerResource->getInstance() JROOT/libraries/vendor/joomla/di/src/Container.php:95
17 Joomla\DI\Container->get() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Factory.php:48
18 VDM\Joomla\Abstraction\Factory::_() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Get.php:1110
19 VDM\Joomla\Componentbuilder\Compiler\Helper\Get->__construct() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Structure.php:419
20 VDM\Joomla\Componentbuilder\Compiler\Helper\Structure->__construct() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php:303
21 VDM\Joomla\Componentbuilder\Compiler\Helper\Interpretation->__construct() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Infusion.php:64
22 VDM\Joomla\Componentbuilder\Compiler\Helper\Infusion->__construct() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Compiler.php:84
23 VDM\Joomla\Componentbuilder\Compiler\Helper\Compiler->__construct() JROOT/administrator/components/com_componentbuilder/src/Model/CompilerModel.php:299
24 VDM\Component\Componentbuilder\Administrator\Model\CompilerModel->builder() JROOT/administrator/components/com_componentbuilder/src/Controller/CompilerController.php:129
25 VDM\Component\Componentbuilder\Administrator\Controller\CompilerController->compiler() JROOT/libraries/src/MVC/Controller/BaseController.php:730
26 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143
27 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
28 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:150
29 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:205
30 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:306
31 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:58
32 require_once() JROOT/administrator/index.php:32

Which Joomla version are you compiling in?

Joomla! 5.2.4 Stable [ Uthabiti ] 18-February-2025 16:00 GMT

Which PHP version are you compiling in?

8.2.24

Which Joomla versions are you targeting?

Joomla! 5.2.4 Stable [ Uthabiti ] 18-February-2025 16:00 GMT

Which PHP version are you targeting?

8.2.24

Which Web server is JCB running on?

Apache/2.4.62 (Debian)

Which Relational Database is JCB running on?

11.6.2-MariaDB-ubu2404

Which OS is JCB running on?

Linux 897f9528f37d 6.11.0-18-generic #18-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 7 22:34:25 UTC 2025 x86_64

Which JCB version are you using?

5.1.0

Where in JCB did this issue occur?

Compilation of a component

On which browsers did you encounter the issue?

Firefox

Additional Comments

Using Octojoom Docker as server stack

### What Happened? When Adding new admin views to component, or new Fields to view then compiling, gives error when updating the SQL of the component ### Steps to reproduce the Bug Compile an existing Component and Install it Add a new admin view to the component or Add new field to Admin view Compile An error has occurred. 0 VDM\Joomla\Componentbuilder\Compiler\Model\Updatesql::add(): Argument #2 ($item) must be of type int, string given, called in /var/www/html/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Updatesql.php on line 189 Call Stack # Function Location 1 () JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Updatesql.php:213 2 VDM\Joomla\Componentbuilder\Compiler\Model\Updatesql->add() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Updatesql.php:189 3 VDM\Joomla\Componentbuilder\Compiler\Model\Updatesql->set() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Fields.php:200 4 VDM\Joomla\Componentbuilder\Compiler\Model\Fields->set() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Adminview/Data.php:518 5 VDM\Joomla\Componentbuilder\Compiler\Adminview\Data->getData() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Adminview/Data.php:356 6 VDM\Joomla\Componentbuilder\Compiler\Adminview\Data->set() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Adminview/Data.php:325 7 VDM\Joomla\Componentbuilder\Compiler\Adminview\Data->get() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Adminviews.php:167 8 VDM\Joomla\Componentbuilder\Compiler\Model\Adminviews->VDM\Joomla\Componentbuilder\Compiler\Model\{closure}() 9 array_map() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Adminviews.php:121 10 VDM\Joomla\Componentbuilder\Compiler\Model\Adminviews->set() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component/Data.php:631 11 VDM\Joomla\Componentbuilder\Compiler\Component\Data->setViews() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component/Data.php:444 12 VDM\Joomla\Componentbuilder\Compiler\Component\Data->energize() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component/Data.php:320 13 VDM\Joomla\Componentbuilder\Compiler\Component\Data->get() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component.php:38 14 VDM\Joomla\Componentbuilder\Compiler\Component->__construct() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Service/Component.php:99 15 VDM\Joomla\Componentbuilder\Compiler\Service\Component->getCompilerComponent() JROOT/libraries/vendor/joomla/di/src/ContainerResource.php:166 16 Joomla\DI\ContainerResource->getInstance() JROOT/libraries/vendor/joomla/di/src/Container.php:95 17 Joomla\DI\Container->get() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Abstraction/Factory.php:48 18 VDM\Joomla\Abstraction\Factory::_() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Get.php:1110 19 VDM\Joomla\Componentbuilder\Compiler\Helper\Get->__construct() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Structure.php:419 20 VDM\Joomla\Componentbuilder\Compiler\Helper\Structure->__construct() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Interpretation.php:303 21 VDM\Joomla\Componentbuilder\Compiler\Helper\Interpretation->__construct() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Infusion.php:64 22 VDM\Joomla\Componentbuilder\Compiler\Helper\Infusion->__construct() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Compiler.php:84 23 VDM\Joomla\Componentbuilder\Compiler\Helper\Compiler->__construct() JROOT/administrator/components/com_componentbuilder/src/Model/CompilerModel.php:299 24 VDM\Component\Componentbuilder\Administrator\Model\CompilerModel->builder() JROOT/administrator/components/com_componentbuilder/src/Controller/CompilerController.php:129 25 VDM\Component\Componentbuilder\Administrator\Controller\CompilerController->compiler() JROOT/libraries/src/MVC/Controller/BaseController.php:730 26 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143 27 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361 28 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:150 29 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:205 30 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:306 31 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:58 32 require_once() JROOT/administrator/index.php:32 ### Which Joomla version are you compiling in? Joomla! 5.2.4 Stable [ Uthabiti ] 18-February-2025 16:00 GMT ### Which PHP version are you compiling in? 8.2.24 ### Which Joomla versions are you targeting? Joomla! 5.2.4 Stable [ Uthabiti ] 18-February-2025 16:00 GMT ### Which PHP version are you targeting? 8.2.24 ### Which Web server is JCB running on? Apache/2.4.62 (Debian) ### Which Relational Database is JCB running on? 11.6.2-MariaDB-ubu2404 ### Which OS is JCB running on? Linux 897f9528f37d 6.11.0-18-generic #18-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 7 22:34:25 UTC 2025 x86_64 ### Which JCB version are you using? 5.1.0 ### Where in JCB did this issue occur? Compilation of a component ### On which browsers did you encounter the issue? Firefox ### Additional Comments Using Octojoom Docker as server stack
Marco Aldana added the
Bug
label 2025-02-25 19:13:57 +00:00
Author
Member

I tested, adding to my component the GUID field from demo component, it gives this error
I also tried to add the looks admin view, same error

So it apperas it is not an error on my fields or admin views, but the compiler not being able to create the update SQL for the component.

I tested, adding to my component the GUID field from demo component, it gives this error I also tried to add the looks admin view, same error So it apperas it is not an error on my fields or admin views, but the compiler not being able to create the update SQL for the component.
Owner

This is indeed a bug... we will release a fix soon!

What I can do now, and a quick fix... is give you the whole class, please test this new class JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Updatesql.php and let me know if it resolves the issue.

Replace the whole file with the one I uploaded here.

This is indeed a bug... we will release a fix soon! What I can do now, and a quick fix... is give you the whole class, please test this new class `JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Updatesql.php` and let me know if it resolves the issue. Replace the whole file with the one I uploaded here.

This is indeed a bug... we will release a fix soon!

What I can do now, and a quick fix... is give you the whole class, please test this new class JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Updatesql.php and let me know if it resolves the issue.

Replace the whole file with the one I uploaded here.

it works now.

> This is indeed a bug... we will release a fix soon! > > What I can do now, and a quick fix... is give you the whole class, please test this new class `JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Model/Updatesql.php` and let me know if it resolves the issue. > > Replace the whole file with the one I uploaded here. it works now.
Author
Member

it works now!

it works now!
Author
Member

Correction it is working for new admin views, but when a single field is added to a view, it shows no error, but does not create the update SQL

Correction it is working for new admin views, but when a single field is added to a view, it shows no error, but does not create the update SQL
Owner

Please review these videos, and make sure you understand how it works:

Please review these videos, and make sure you understand how it works: - [Basic Idea](https://www.youtube.com/watch?v=bRPJTRat158&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=37&pp=iAQB) - [Detailed understanding](https://www.youtube.com/watch?v=zN2M15fzf_M&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=52&pp=iAQB)
Author
Member

Thank you @Llewellyn, I checked the videos and I'll elaborate on my response.

Expected behavior, if I add a new view to my component, a new create table statement is produced in the MysQL updates area, and a new version field is added incrementing the component version, this works as it should with the fix you provided.

Still when I add a field to an existing view, it has a history and was built from the ground up, it is failing to create the Alter Table statements to add such field to the table. So I'm needing to add them manually as I go.

Thank you @Llewellyn, I checked the videos and I'll elaborate on my response. Expected behavior, if I add a new view to my component, a new create table statement is produced in the MysQL updates area, and a new version field is added incrementing the component version, this works as it should with the fix you provided. Still when I add a field to an existing view, it has a history and was built from the ground up, it is failing to create the Alter Table statements to add such field to the table. So I'm needing to add them manually as I go.
Member

This is happening to me too, i updated to 5.1.0 for J5 and since this issue happening. I tried copying the content of the updated Updatesql.php here but i have not seen an inprovement yet. New components work correctly and new admin views too. It's the updating of existing admin views that's not updating the tables correctly. Additionally, when i download a component there used to be sql updates in admin\sql\updates\mysql of the zipfile, i cannot find them there anymore. I don't know if that's part of the change to J4/5 or if that's unintentional.

This is happening to me too, i updated to 5.1.0 for J5 and since this issue happening. I tried copying the content of the updated Updatesql.php here but i have not seen an inprovement yet. New components work correctly and new admin views too. It's the updating of existing admin views that's not updating the tables correctly. Additionally, when i download a component there used to be sql updates in admin\sql\updates\mysql of the zipfile, i cannot find them there anymore. I don't know if that's part of the change to J4/5 or if that's unintentional.
Member

Thanks for reporting this, we have also identified this issue on our side and we are working on a fix.

Thanks for reporting this, we have also identified this issue on our side and we are working on a fix.
Sign in to join this conversation.
5 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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