[BUG]: Componentbuiilder/Compiler/Language/Purge.php passing array to /Update.php - expecting string (J3) #1235
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?
I'm getting the following error when trying to compile with JCB 3.2.4 on Joomla 3.10.12:
Call stack
Function Location
1 () JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Language/Update.php:75
2 VDM\Joomla\Componentbuilder\Compiler\Language\Update->set() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Language/Purge.php:165
3 VDM\Joomla\Componentbuilder\Compiler\Language\Purge->handleUnlinkedString() JROOT/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Language/Purge.php:115
Steps to reproduce the Bug
Make some changes to several lines of codes throughout the component that use the enqueueMessage function, changing the string inside the message area.
Re-compile.
Then the bug happens
Which Joomla version are you compiling in?
3.10.12
Which PHP version are you compiling in?
8.0
Which Joomla versions are you targeting?
3.10.12
Which PHP version are you targeting?
8.0
Which Web server is JCB running on?
Apache/2.4.56 (on Octojoom)
Which Relational Database is JCB running on?
MariDB 11.7.2
Which OS is JCB running on?
Octojoom on Kubuntu
Which JCB version are you using?
3.2.4
Where in JCB did this issue occur?
Compilation of a component
On which browsers did you encounter the issue?
Firefox
Additional Comments
In the /libraries/vendor_jcb/VDM_Joomla/src/Componentbuilder/Compiler/Language/Purge.php file,
in the handleUnlinkedString() function, at line ~165
it calls the $this->update-set() function
it passes the variable "$targets" to that function as argument #2.
That variable ($targets) is provided when the handleUnlinkedString() function is called, and is of the type array.
So it appears that there is a miss-match in this.
set() in Purge is expecting a string ($target),
but handleUnlinkedString is passing an array ($targets).
I realize that this version of JCB is now EOL, but wondering if there is a simple fix to resolve this bug.
Can I just manually 'purge' all the language strings from the project and have them rebuild all of them to get around this issue?
(I have this project on JCB3 that we need to get somewhat stable before moving to JCB4/5, and we're almost there, pending this error).
FYI ... here's the existing code snippets ...
From Purge.php:
Hmmm ... it seems to be passing the $targets as both the 2nd AND 3rd parameter.
I don't quite understand, from the code, why that would be like that.
Any ideas?
NOTE/WORK-AROUND: I found an easy work-around for this issue.
Now the component will compile and re-generate all the entries in the Language Translations area.
NOTE: If you created any custom translations, they will likely be lost, but at least the component will compile. And you can manually re-translate. Or I guess you could re-export the new entries generated, then write a script to pull the translations from the original backup export and pull that translation text into the new export and then pull those back in. (Might be a good task for AI :-) )
However, the code problem is still there. Hopefully not there in JCB5 versions.
FYI ... I found, in comparing the original language translations export to the newly generated one, that the problem was that I removed some un-needed functionality in the component, which then resulted in those language strings being 'unlinked' (I'm guessing), which then initiated that function to remove them.
So, I guess we need to just not remove any functionality (that has language strings), unless this function is fixed.
(Again, if this is resolved in later JCB versions, then this should be closed as JCB3 no longer supported for fixes like this, although it would be nice to have this fixed).