I have a multilingual website where everything was running fine under J3. I migrated to J4 (and also switched to YOOtheme Pro. I mention it just in case).
And now the Edit button on the Association Tab (for Articles and for Menu Items) always give a 404.
After some tests, I realized that I could see in the Console that the called url was actually
/administrator/index.php?option=com_content&view=article&layout=modal&tmpl=component&5e96bdc0cbf704b5fb49000b5e90d4b4=1&forcedLanguage=nl-NL&task=article.edit&id=%27%20272%20%27
I was puzzled by the %27%20272%20%27 at the end of the url. The Article ID in this case was 272 so I manually typed the following url (dropping the "%27%20" before and the "%20%27" after the item ID:
/administrator/index.php?option=com_content&view=article&layout=modal&tmpl=component&5e96bdc0cbf704b5fb49000b5e90d4b4=1&forcedLanguage=nl-NL&task=article.edit&id=272
And there the page works (I open it on a separate Tab, even if it is supposed to be a Modal of course).
So what is wrong? Why these "%27%20" before and "%20%27" after the Article or Menu Item ID?
Txs for your suggestions! (I also tried different PHP versions just in case but that would not solve anything)
EDIT1: actually I discovered this bug in the context of Multilingual Association, but the same issue arises with the classical "Edit" article button that can be found when Editing a Menu Item
EDIT2: FYI here is the corresponding HTML in the page (which is exactly similar to the HTML on another J4 site where everything works fine)
<div id="ModalEditArticle_jform_associations_fr_FR" tabindex="-1" class="joomla-modal modal fade" data-bs-backdrop="static" data-bs-keyboard="false" data-url="index.php?option=com_content&view=article&layout=modal&tmpl=component&165fca538bd5a6f8ec413c37271fbfd8=1&forcedLanguage=fr-FR&task=article.edit&id=' + document.getElementById("jform_associations_fr_FR_id").value + '" data-iframe="<iframe class="iframe" src="index.php?option=com_content&amp;view=article&amp;layout=modal&amp;tmpl=component&amp;165fca538bd5a6f8ec413c37271fbfd8=1&amp;forcedLanguage=fr-FR&amp;task=article.edit&amp;id=' + document.getElementById(&quot;jform_associations_fr_FR_id&quot;).value + '" name="Edit Article" title="Edit Article" height="400px" width="800px"></iframe>" style="display: none;" aria-hidden="true">
document.getElementById("[the_article_id]_id").value
? Is it space-padded and quoted?document.getElementById("jform_associations_fr_FR_id").value
in the Console, I get'267'
(I get a similar result on another J4 site where the Edit button works fine) So it is as if "something" was adding that %27%20 before and %20%27 after the ID I also made another test: In the file ArticleField.php mentioned below if I replace$urlEdit = $linkArticle . '&task=article.edit&id=\' + document.getElementById("' . $this->id . '_id").value + \'';
by$urlEdit = $linkArticle . '&task=article.edit&id=267';
then the Modal works fine (no 404)var_dump($urlEdit);
to see the byte count. It the count is different from the number of characters, something is afoul.string(253) "index.php?option=com_content&view=article&layout=modal&tmpl=component&165fca538bd5a6f8ec413c37271fbfd8=1&forcedLanguage=fr-FR&task=article.edit&id=' + document.getElementById("jform_associations_fr_FR_id").value + '" string(253) "index.php?option=com_content&view=article&layout=modal&tmpl=component&165fca538bd5a6f8ec413c37271fbfd8=1&forcedLanguage=en-GB&task=article.edit&id=' + document.getElementById("jform_associations_en_GB_id").value + '"
"
etc: document.getElementById("' . $this->id . '_id").value But even like that, I still get%27%20MYARTICLEID%20%27
where MYARTICLEID is the true wished Article ID This make me think of a server-side issue, configuration of PHP, something in htaccess for example. Because as such ArticleField.php is correct