error at view edit with php 8

  • Posts: 507
  • Thank you received: 21
  • Hikashop Business
2 years 5 months ago #342137

-- HikaShop version -- : 4.6.0
-- Joomla version -- : 4.1.4
-- PHP version -- : 8.0
-- Error-message(debug-mod must be tuned on) -- : 3 arguments are required, 2 given

Hi,

When editing any view there's an error on my testsite in Joomla 4 with php 8.0: 3 arguments are required, 2 given. Seen screenshot and error pdf.

When changing the php to version 7.4 the error doesn't occur.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 5 months ago #342141

Hi,

It was great that you provided the callstack PDF. However, half of the callstack display is missing from the PDF. Normally, it should have the file path and line number for each row of the list.
Could you provide the full callstack of the error ?

Please Log in or Create an account to join the conversation.

  • Posts: 507
  • Thank you received: 21
  • Hikashop Business
2 years 5 months ago #342143

Hi Nicolas,

Here's the callstack once more:

Call stack
# Function Location
1 () JROOT/libraries/src/Language/Text.php:302
2 sprintf() JROOT/libraries/src/Language/Text.php:302
3 Joomla\CMS\Language\Text::sprintf() JROOT/plugins/editors/codemirror/layouts/editors/codemirror/element.php:60
4 include() JROOT/libraries/src/Layout/FileLayout.php:128
5 Joomla\CMS\Layout\FileLayout->render() JROOT/libraries/src/Layout/LayoutHelper.php:73
6 Joomla\CMS\Layout\LayoutHelper::render() JROOT/plugins/editors/codemirror/codemirror.php:268
7 PlgEditorCodemirror->onDisplay() JROOT/libraries/src/Editor/Editor.php:198
8 Joomla\CMS\Editor\Editor->display() JROOT/administrator/components/com_hikashop/helpers/editor.php:135
9 hikashopEditorHelper->displayCode() JROOT/administrator/components/com_hikashop/views/view/tmpl/form.php:97
10 include() JROOT/libraries/src/MVC/View/HtmlView.php:436
11 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/administrator/components/com_hikashop/helpers/helper.php:2722
12 hikashopView->loadTemplate() JROOT/libraries/src/MVC/View/HtmlView.php:220
13 Joomla\CMS\MVC\View\HtmlView->display() JROOT/administrator/components/com_hikashop/helpers/helper.php:2677
14 hikashopView->display() JROOT/administrator/components/com_hikashop/views/view/view.html.php:23
15 ViewViewView->display() JROOT/libraries/src/MVC/Controller/BaseController.php:697
16 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/administrator/components/com_hikashop/helpers/helper.php:2400
17 hikashopController->display() JROOT/administrator/components/com_hikashop/helpers/helper.php:2126
18 hikashopController->edit() JROOT/libraries/src/MVC/Controller/BaseController.php:735
19 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/administrator/components/com_hikashop/helpers/helper.php:2378
20 hikashopController->execute() JROOT/administrator/components/com_hikashop/hikashop.php:73
21 require_once() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:69
22 Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
23 Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:389
24 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:143
25 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:186
26 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:278
27 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:63
28 require_once() JROOT/administrator/index.php:32

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 5 months ago #342146

Hi,

It seems to be a bug from Joomla 4.1.1 with the codemirror plugin:
forum.joomla.org/viewtopic.php?f=823&t=993766
The issue is linked to the code:

<?php echo Text::sprintf('PLG_CODEMIRROR_TOGGLE_FULL_SCREEN', $fullScreenCombo); ?>
in the file plugins/editors/codemirror/layouts/editors/codemirror/element.php
Removing that line should fix the problem.
However, it seems that the problem stems from the translation key PLG_CODEMIRROR_TOGGLE_FULL_SCREEN which is wrong in a translation file of your website.
Try while logged in in English and you should normally not have the problem, even without removing that line of code.
I checked the nl-NL translation file for that plugin from Joomla (in administrator/language/nl-NL/plg_editors_codemirror.ini), and the line is:
PLG_CODEMIRROR_TOGGLE_FULL_SCREEN="Druk op %s om 'Volledig scherm' bewerken te wisselen."
However, the error indicates that you have two %s in that translation instead of one.
So please check this.

The following user(s) said Thank You: Larry3460

Please Log in or Create an account to join the conversation.

  • Posts: 585
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
1 year 11 months ago #347066

Hi Nicolas,

I have a same issue with PHP 8.0.

Also error on the front-end:
0
3 arguments are required, 2 given

But deleting %1$s and %2$s from administrator/language/nl-NL/plg_editors_codemirror.ini doesn't fix the issue.

PLG_CODEMIRROR_TOGGLE_FULL_SCREEN="Druk op %1$s %2$s om te schakelen naar volledig scherm tekstverwerken."

See my Call Stack

Call stack
# Function Location
1 () JROOT/libraries/src/Language/Text.php:321
2 sprintf()
3 call_user_func_array() JROOT/libraries/src/Language/Text.php:321
4 Joomla\CMS\Language\Text::sprintf() JROOT/media/com_hikashop/mail/order_admin_notification.text.php:16
5 require() JROOT/administrator/components/com_hikashop/classes/mail.php:367
6 hikashopMailClass->loadEmail() JROOT/administrator/components/com_hikashop/classes/mail.php:32
7 hikashopMailClass->get() JROOT/administrator/components/com_hikashop/classes/order.php:1997
8 hikashopOrderClass->loadOrderNotification() JROOT/administrator/components/com_hikashop/classes/order.php:460
9 hikashopOrderClass->save() JROOT/administrator/components/com_hikashop/classes/order.php:906
10 hikashopOrderClass->createFromCart() JROOT/components/com_hikashop/controllers/checkout.php:674
11 checkoutController->confirm() JROOT/libraries/src/MVC/Controller/BaseController.php:702
12 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/administrator/components/com_hikashop/helpers/helper.php:2408
13 hikashopController->execute() JROOT/components/com_hikashop/hikashop.php:88
14 require_once() JROOT/libraries/src/Component/ComponentHelper.php:402
15 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:377
16 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:194
17 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:233
18 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:225
19 Joomla\CMS\Application\CMSApplication->execute() JROOT/index.php:49


Kind regards,
Lumiga
Last edit: 1 year 11 months ago by Lumiga.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 11 months ago #347070

Hi,

Per your callstack, the issue comes from the translation key used on line 16 of the "text" version of the "order admin notification" email.
On my end, I've got this line:

echo "\r\n".str_replace('<br/>',"\r\n",JText::sprintf('ACCESS_ORDER_WITH_LINK',$url));
So, as you can see, there is one parameter for the translation which is $url.

However, if I check the nl-NL translation file of HikaShop, I can see this:
ACCESS_ORDER_WITH_LINK="De besteldetails zijn rechtstreeks te bereiken door op de onderstaande link te klikken na het inloggen op de back-end:"
while in English, I see this:
ACCESS_ORDER_WITH_LINK="You can access the order details directly by clicking on the link below after logging in your back end:<br/><a href='%1$s'>%1$s</a>"
So for some reason, it seems one person who provided translations for the nl-NL language removed the part
<br/><a href='%1$s'>%1$s</a>
that's probably why you're getting that error.
I've updated the nl-NL language file. You can directly modify the language file on your end and it should fix the problem.

The following user(s) said Thank You: Lumiga

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 1
  • Hikashop Business
1 year 9 months ago #349103

Hi

I have a very similar problem. Can you also help me?

You do not have permissions to access this page.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 9 months ago #349104

Hi,

The error "You do not have permissions to access this page." indicates that you have a security mechanism which is prehentively blocking the request (I suppose you're trying to save modifications to a view or an email). It's either a security extension like RS Firewall, or something installed on the server.
The best would be to check with the support of that security extension, or your hosting (if it's something on the server) on how to authorize what you're trying to do while still keeping the security extension/software enabled.

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 1
  • Hikashop Business
1 year 9 months ago #349122

Hi Nicolas,

Oh sorry, the phrase "You do not have permissions to access this page" was automatically inserted because I wasn't logged in :whistle: . For me, it's about the two attachments.



Attachments:
Last edit: 1 year 9 months ago by martin.petras.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 9 months ago #349124

Hi,

That's better with the real error message :)
As you found out, it's pointing at the line 494 of the preload of an email. And as with the other reports on this thread, it points at an invalid translation for either the translation key PLEASE_TRANSFERT_MONEY or INCLUDE_ORDER_NUMBER_TO_TRANSFER which are used on that line.
The error "3 arguments are required, 2 given" basically means that there are two %s in the translation key but HikaShop's code only provide one variable.
I can also see that your website is in German.
So I checked the translation keys of the de-DE language file of HikaShop and found these:

PLEASE_TRANSFERT_MONEY="Sie können mit Hilfe der folgenden Angaben, den Betrag von %s überweisen."
INCLUDE_ORDER_NUMBER_TO_TRANSFER="Bitte vergessen Sie nicht, Ihre Bestellnummer ( %s ) bei Verwendungszweck der Überweisung anzugeben, um diese Ihrer Bestellung zuordnen zu können."
As you can see, for each translation key, there is only one %s in the default language file of HikaShop.
So this means that the problem is not on end, only on your website, and you must have a translation override for either translation key with two %s instead of one.
So please check your translation overrides under the Languages tab of the HikaShop configuration and look for these two translation keys.

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 1
1 year 7 months ago #350869

Hi,

I'm facing the same issue too.
in my case it's when some registered user try to edit one article.
So I reproduce the call stack right here, as it comes :

3 arguments are required, 2 given

Call stack
# Function Location
1 () JROOT/libraries/src/Language/Text.php:283
2 sprintf() JROOT/libraries/src/Language/Text.php:283
3 Joomla\CMS\Language\Text::sprintf() JROOT/plugins/editors/codemirror/layouts/editors/codemirror/element.php:67
4 include() JROOT/libraries/src/Layout/FileLayout.php:128
5 Joomla\CMS\Layout\FileLayout->render() JROOT/libraries/src/Layout/LayoutHelper.php:76
6 Joomla\CMS\Layout\LayoutHelper::render() JROOT/plugins/editors/codemirror/codemirror.php:268
7 PlgEditorCodemirror->onDisplay() JROOT/libraries/src/Editor/Editor.php:194
8 Joomla\CMS\Editor\Editor->display() JROOT/libraries/src/Form/Field/EditorField.php:251
9 Joomla\CMS\Form\Field\EditorField->getInput() JROOT/libraries/src/Form/FormField.php:1029
10 Joomla\CMS\Form\FormField->renderField() JROOT/libraries/src/Form/Form.php:536
11 Joomla\CMS\Form\Form->renderField() JROOT/components/com_content/tmpl/form/edit.php:57
12 include() JROOT/libraries/src/MVC/View/HtmlView.php:410
13 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/libraries/src/MVC/View/HtmlView.php:203
14 Joomla\CMS\MVC\View\HtmlView->display() JROOT/components/com_content/src/View/Form/HtmlView.php:197
15 Joomla\Component\Content\Site\View\Form\HtmlView->display() JROOT/libraries/src/MVC/Controller/BaseController.php:639
16 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/components/com_content/src/Controller/DisplayController.php:121
17 Joomla\Component\Content\Site\Controller\DisplayController->display() JROOT/libraries/src/MVC/Controller/BaseController.php:672
18 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143
19 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT/components/com_content/src/Dispatcher/Dispatcher.php:56
20 Joomla\Component\Content\Site\Dispatcher\Dispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:355
21 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:208
22 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:249
23 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:294
24 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:61
25 require_once() JROOT/index.php:32


I tried already to comment the line
<?php echo Text::sprintf('PLG_CODEMIRROR_TOGGLE_FULL_SCREEN', $fullScreenCombo); ?>
without success.

One precision more : I'm using the French language pack fr-FR 3.10.11.1

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 7 months ago #350870

Hi,

You have the same error as the person in the first message of this thread.
So my answer www.hikashop.com/forum/content-creation/...th-php-8.html#342146 is the correct one for you.
Instead of commenting the line, please remove it. And as I said, the error is in the translations of your website for PLG_CODEMIRROR_TOGGLE_FULL_SCREEN so you could search for that text in all the ini files of your website and you should find one with 2 %s instead of 1. Fixing the translation would also fix the error.

The following user(s) said Thank You: Larry3460

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 1
1 year 7 months ago #350884

Hello,
I finally found the said text in : public_html/administrator/language/fr-FR/fr-FR.plg.editors.codemirror.ini
It was written :

PLG_CODEMIRROR_TOGGLE_FULL_SCREEN="Appuyer sur %1$s %2$s pour activer/désactiver le mode d'édition plein écran. "
and I corrected it as :
PLG_CODEMIRROR_TOGGLE_FULL_SCREEN="Appuyer sur %1$s pour activer/désactiver le mode d'édition plein écran. "

Now I've no more this error. Yous solved magisterially that issue.

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.083 seconds
Powered by Kunena Forum