joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.71k stars 3.64k forks source link

Frontend editable module of "Custom" type cannot be saved anymore #37438

Open oorzaak opened 2 years ago

oorzaak commented 2 years ago

Steps to reproduce the issue

Create a module of the type "Custom", make it visible in frontend and set Permissions to "Frontend Editing: Allowed" for user group "Publisher" (also make sure that "Edit" is allowed. Create a user in the "Publisher" user group and login as this user in the frontend. In the frontend, click the "Edit" button of the module that you created and edit it's content and/or title. Click "Save"

Expected result

I expect the changes to be saved.

Actual result

My changes are not saved; instead I get this error message: {"error":true,"code":0,"message":"Ongeldig veld: COM_MODULES_FIELD_PUBLISH_UP_LABEL"}

Note: "Ongeldig veld" is a local rendering of the language constant: JLIB_FORM_FIELD_INVALID It is displayed in my local language (Dutch) even though I've set both frontend and backend language preferences of my user to English.

System information (as much as possible)

J.4.1.2 Both on php 8.0.17 and 7.4.28 10.5.15-MariaDB

Additional comments

I started working on this site months ago using J.4.0.0. At some point during the development I added this particular module and made it frontend editable. I tested it and at the time it worked as expected. I am not sure in which J. version the site was by then.

I experienced / replicated this issue on three different J.4 sites, one of them with the original Cassiopeia template, the other two with custom made forks of Cassiopeia.

chmst commented 2 years ago

What happens when you set a date into publish_up?

drmenzelit commented 2 years ago

Can't replicate on a local (xampp) 4.1.2 installation. I was able to edit and save the changes on the custom module DB: 10.4.22-MariaDB PHP: 8.0.14

oorzaak commented 2 years ago

Thanks for your replies.

What happens when you set a date into publish_up?

The result is still the same


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37438.

chmst commented 2 years ago

I cannot replicate that on win11, xampp, php 8.1

chmst commented 2 years ago

@oorzaak Which language are you using?

oorzaak commented 2 years ago

I take your words for it.

However, I just replicated the issue in another site that I made from scratch, using the J.4.1.2 full package without changing any settings or installing any other extensions. This time I did not upload any other languages than English either.

The error message is now: {"error":true,"code":0,"message":"Invalid field: COM_MODULES_FIELD_PUBLISH_UP_LABEL"}

This is on the same hosting as one of the sites mentioned above. The four sites that I have now where I can see this issue on, are distributed over two different "live" servers (as in: not local).


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37438.

chmst commented 2 years ago

Still trying to find what happens there as I cannot replicate the problem. Can you give some technical details about your environment? System, PHP version? Can you make screenshots or a viedo?

oorzaak commented 2 years ago

Hi, I've put up a screen video here: https://youtu.be/EmEJiuLbSME

System information as reported by Joomla: Setting Value PHP Built On Linux srv1.oorzaak-hosting.nl 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 Database Type mysql Database Version 10.5.15-MariaDB Database Collation latin1_swedish_ci Database Connection Collation utf8mb4_general_ci Database Connection Encryption None Database Server Supports Connection Encryption No PHP Version 7.4.28 Web Server Apache/2 WebServer to PHP Interface fpm-fcgi Joomla! Version Joomla! 4.1.2 Stable [ Kuamini ] 30-March-2022 16:00 GMT User Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:97.0) Gecko/20100101 Firefox/97.0

brianteeman commented 2 years ago

In your video I can see that you are not using either of the default editors. In order to rule out an issue with your editor please test with both tinymce and codemirror.

drmenzelit commented 2 years ago

If possible also have a look at the log files from server

oorzaak commented 2 years ago

Using TinyMce or CodeMirror gives the same result. I already tried this but maybe I didn't mention it above. I created a new screeen video using both: https://youtu.be/BrZqJenm31A

About server log files: I'm not familiar with the interpretation of server logs. First of all, I see that I can select from about 15 different logs in my DirectAdmin. Which log would be relevant in this case?

drmenzelit commented 2 years ago

at best some log file with error in the name: error.log or php-error.log... something like that

richard67 commented 2 years ago

Normally providers have some online documentation on that.

oorzaak commented 2 years ago

Hi, I didn't find a php error log yet, contacted my provider about it and am awaiting their reply. However, after some tweaking in Joomla I managed to create the report below (as stored in /administrator/logs). Hopefully this sheds some more light:

Date: 2022-04-15 15:18:57 UTC

Software: Joomla! 4.1.2 Stable [ Kuamini ] 30-March-2022 16:00 GMT

Fields: datetime priority clientip category message

2022-04-15T15:18:57+00:00 CRITICAL 2a02:a464:4521:1:5478:cc6e:2fe:f22c error Uncaught Throwable of type RuntimeException thrown with message "Invalid field: COM_MODULES_FIELD_PUBLISH_UP_LABEL". Stack trace:

0 [ROOT]/libraries/src/MVC/Model/FormModel.php(219): Joomla\CMS\Form\Form->validate()

1 [ROOT]/administrator/components/com_modules/src/Model/ModuleModel.php(970): Joomla\CMS\MVC\Model\FormModel->validate()

2 [ROOT]/libraries/src/MVC/Controller/FormController.php(647): Joomla\Component\Modules\Administrator\Model\ModuleModel->validate()

3 [ROOT]/administrator/components/com_modules/src/Controller/ModuleController.php(250): Joomla\CMS\MVC\Controller\FormController->save()

4 [ROOT]/components/com_config/src/Controller/ModulesController.php(124): Joomla\Component\Modules\Administrator\Controller\ModuleController->save()

5 [ROOT]/libraries/src/MVC/Controller/BaseController.php(735): Joomla\Component\Config\Site\Controller\ModulesController->save()

6 [ROOT]/libraries/src/Dispatcher/ComponentDispatcher.php(146): Joomla\CMS\MVC\Controller\BaseController->execute()

7 [ROOT]/libraries/src/Component/ComponentHelper.php(389): Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch()

8 [ROOT]/libraries/src/Application/SiteApplication.php(204): Joomla\CMS\Component\ComponentHelper::renderComponent()

9 [ROOT]/libraries/src/Application/SiteApplication.php(243): Joomla\CMS\Application\SiteApplication->dispatch()

10 [ROOT]/libraries/src/Application/CMSApplication.php(278): Joomla\CMS\Application\SiteApplication->doExecute()

11 [ROOT]/includes/app.php(63): Joomla\CMS\Application\CMSApplication->execute()

12 [ROOT]/index.php(32): require_once('/home/dev/domai...')

13 {main}

chmst commented 2 years ago

Thank you for that - I found it. Your user has not the permission for edit-state. So it would be a workaround if you grant your user the edit.state permission (not quite sure yet which combinations of permissions cause the effect, but I could replicate the problem when I withdray my publisher the edit.state).

oorzaak commented 2 years ago

Hi Christiane,

Thanks for your reply. I changed the permissions, however I get a different error message now when clicking Save or Save & Close: JERROR_SAVE_FAILED

The rest of the page looks normal now, when this error message appears.

And in spite of this message, the edits are saved, as I can see when I click Cancel after this.

[edited to provide more details]

drmenzelit commented 2 years ago

Maybe you should check all permissions for the user group. I don't think that is a Joomla bug (we would have lots of issues then), but something wrong on the permissions in your installation.

chmst commented 2 years ago

In my opinion it is a bug. If permissions are set incorrectly, the system can react other than expected, but it should not throw such an error message. If the edit.state permission is not granted, publish_up and _down must be disabled. But the field is in the request as an input field. Disabled & input together throw this error.