? Success

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
23 Apr 2015

PR summary

In this line of of code https://github.com/joomla/joomla-cms/blob/staging/components/com_config/controller/modules/save.php#L83, the $app and $data variables are not defined and it can cause fatal error if saving a module in frontend (using frontend module editing) return false for some reasons. This PR fixes that mistake

Testing instructions

I think this PR just need a quick review from CMS maintainers to get it merged. If you want to test, just try to edit a module from frontend and make sure it is still saved properly.

avatar joomdonation joomdonation - open - 23 Apr 2015
avatar zero-24 zero-24 - change - 29 Apr 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 29 Apr 2015
Labels Removed: ?
avatar zero-24 zero-24 - change - 29 Apr 2015
Labels Added: ?
avatar zero-24
zero-24 - comment - 29 Apr 2015

@test edit a module from frontend still works with this PR :smile:

avatar zero-24 zero-24 - change - 29 Apr 2015
Category Front End
avatar zero-24 zero-24 - change - 29 Apr 2015
Status New Pending
Easy No Yes
avatar zero-24 zero-24 - test_item - 29 Apr 2015 - Tested successfully
avatar joomdonation
joomdonation - comment - 29 Apr 2015

@zero-24 Done. Space removed.

avatar zero-24
zero-24 - comment - 30 Apr 2015

Thanks so we need only one more tester/PLT to merge. Travis fails here unrelated to this PR. This PR is ok. Thanks!

avatar OctavianC
OctavianC - comment - 5 May 2015

Test successful.

avatar joomdonation
joomdonation - comment - 5 May 2015

Thanks for testing. As this bug can be seen easily by looking at the code and we now have two success tests, I hope PLT will accept and merge it.

avatar zero-24 zero-24 - alter_testresult - 5 May 2015 - OctavianC: Tested successfully
avatar zero-24 zero-24 - change - 5 May 2015
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 5 May 2015

RTC Thanks for your tests :smile:


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

avatar zero-24 zero-24 - change - 5 May 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 5 May 2015
Labels Added: ?
avatar roland-d roland-d - change - 5 May 2015
Status Ready to Commit Pending
avatar roland-d
roland-d - comment - 5 May 2015

Sorry to crash this party but the fix is fine but incomplete. When I save the module on frontend I indeed no longer get the fatal error. However, the error message is displayed as JERROR_SAVE_FAILED so we are missing the translation here. This string is available in the backend language file but not the frontend. This will need to be added as well.

Watch out, this is a string with a replacement tag %s. So the error message needs to be shown as well. This may require a bit more work. Please update the PR with the language string as well. Thank you.

avatar OctavianC
OctavianC - comment - 5 May 2015

You're right, didn't notice that :(

avatar joomdonation
joomdonation - comment - 5 May 2015

I think we can replace it with JLIB_APPLICATION_ERROR_SAVE_FAILED language item, seems it is the same with JERROR_SAVE_FAILED and it is loaded in the frontend as well

However, the difficulty here is that how we can get the detail error? The code in the frontend call a backend controller to save module and I don't know/don't see a way to access to the model to call getError method to get the error. Anyone knows a way to do that?

avatar roland-d
roland-d - comment - 5 May 2015

@brianteeman Hey Brian, I am pulling you in here because we have a language issue. As @joomdonation stated JLIB_APPLICATION_ERROR_SAVE_FAILED and JERROR_SAVE_FAILED are basically the same. How about we eliminate one of them?

@joomdonation I have looked into this on how to get the error message but there is no easy way of doing that because the save controller is in the backend and we are in the frontend. They are extending different baseclasses. The only idea I have is set the error also in the userState and check that perhaps. This is an untested idea ;)

avatar brianteeman
brianteeman - comment - 5 May 2015

We cant remove any string. It was previously decided that we do not remove
strings in case others are using them

On 5 May 2015 at 10:11, RolandD notifications@github.com wrote:

@brianteeman https://github.com/brianteeman Hey Brian, I am pulling you
in here because we have a language issue. As @joomdonation
https://github.com/joomdonation stated
JLIB_APPLICATION_ERROR_SAVE_FAILED and JERROR_SAVE_FAILED are basically the
same. How about we eliminate one of them?

@joomdonation https://github.com/joomdonation I have looked into this
on how to get the error message but there is no easy way of doing that
because the save controller is in the backend and we are in the frontend.
They are extending different baseclasses. The only idea I have is set the
error also in the userState and check that perhaps. This is an untested
idea ;)


Reply to this email directly or view it on GitHub
#6825 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar joomdonation
joomdonation - comment - 5 May 2015

Luckily, after reviewing the code again, I see that when an error happens, controller class also storing error message as well, so we just need to call $controllerClass->getError() to get the error message.

Could @roland-d and @OctavianC help testing it again?

avatar OctavianC
OctavianC - comment - 5 May 2015

After digging a little deeper, it seems that ModulesControllerModule doesn't return the save() result so the Fatal Error will never be encountered in production (it's always going to be null). Also, I'm not sure why ConfigControllerModulesSave is using the controller ModulesControllerModule instead of the model ModulesModelModule? I thought the whole logic of MVC was for the controller to call the model. The model also stores the error so we can use that too.

avatar joomdonation
joomdonation - comment - 5 May 2015

@OctavianC: I was thinking the same. And added return command in my previous commit.

For your second question, I guess the developer who wrote that code want to re-use the code and I don't like it, too. However, for now, I think we can leave it as how it is. If we want to re-factor it, I think we should wait until we have new MVC in Joomla core.

avatar zero-24 zero-24 - change - 5 May 2015
Labels Removed: ?
avatar zero-24 zero-24 - change - 5 May 2015
Labels Removed: ?
avatar zero-24 zero-24 - test_item - 5 May 2015 - Not tested
avatar roland-d
roland-d - comment - 5 May 2015

@joomdonation
So I have been trying to test this change but I can't get an error message to display. What I tried was emptying the value of a required field so the field validation would fail and tell me that I need to fill in the required field. What happens in reality is that the form comes back with no message at all because the $controllerClass has no errors.

The file I changed for testing is libraries/joomla/form/form.php at line 1957 just before that I put

$value = '';

Could you give step-by-step test instructions?

@brianteeman Thank you for your input.

avatar joomdonation
joomdonation - comment - 5 May 2015

@roland-d For some reasons, I could not get the error messages to display, too. When the form validation is false, all the validation error messages will be queued https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/controller/form.php#L708 and should be displayed

Not sure why it is not displayed with frontend module editing :(.

avatar roland-d
roland-d - comment - 8 May 2015

@joomdonation This is very intriguing. When I have some time I will take a closer look at it.

avatar zero-24 zero-24 - change - 20 Oct 2015
Status Pending Needs Review
avatar joomdonation joomdonation - close - 8 Dec 2015
avatar joomdonation joomdonation - change - 8 Dec 2015
Status Needs Review Closed
Closed_Date 0000-00-00 00:00:00 2015-12-08 07:07:40
Closed_By joomdonation
avatar joomdonation joomdonation - close - 8 Dec 2015
avatar joomdonation joomdonation - head_ref_deleted - 19 Dec 2015

Add a Comment

Login with GitHub to post a comment