? Success

User tests: Successful: Unsuccessful:

avatar jo-sf
jo-sf
6 Aug 2016

When changing the global configuration the validated data should always be saved in the session and not only in case of an error when saving the global configuration in configuration.php failed.

There is an issue when writing numeric values in exponential representaion into any of the numeric fields of the global configuration (like "1.5e+1" instead of 15). This form is valid and is accepted by modern browsers as the content of numeric fields, but when it comes to saving such values within Joomla the value is changed but this is not immediately visible for the administrator.

Testing Instructions

Status Quo

  • Open the global configuration form and activate the "System" tab
  • Locate the "Cache Time" field and check its value (the value is "15" by default)
  • Overwrite the default value with "1.5e+1" and press the "Save" button
  • Check the configuration.php file, the value for "$cachetime" is "1"
  • The value shown in the global configuration form is "15"
  • Press the "Save & Close" button
  • Check the configuration.php file, the value for "$cachetime" is "15"

Change

  • Now install this PR
  • Open the global configuration form and activate the "System" tab
  • Replace the value "15" in the "Cache Time" field with "1.5e+1" and press the "Save" button
  • Check the configuration.php file, the value for "$cachetime" is "1"
  • The value shown in the global configuration form is now "1" too
  • Replace the value "1" with "15" and press the "Save & Close" button
  • Check the configuration.php file, the value for "$cachetime" is "15"

Notes

  • It is IMO in general a good idea to save the validated data of a form in the session such that the result of the validation will be shown in case that the form was not closed which is the case if you press the "Save" button. Otherwise the data presented in the form might not be identical to the data saved in the configuration file (in case of the global configuration) or in the database.
  • Even if the exponential representation of a numeric value is somewhat esoteric it is valid and it is accepted by modern browsers if the type of the input field is "number". Due to that the validation method for numeric fields should probably be changed such that it not only accepts such values (which is the case today) but also converts them correctly into a number ("1.5e+1" should be converted into "15", not into "1" as is the case today). But this is beyond the scope of this PR.
avatar joomla-cms-bot joomla-cms-bot - change - 6 Aug 2016
Category Administration Components
avatar jo-sf jo-sf - open - 6 Aug 2016
avatar jo-sf jo-sf - change - 6 Aug 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 6 Aug 2016
Labels Added: ?
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 10 Jan 2017

I have tested this item ? unsuccessfully on 0d273d2

Part "Status Quo": #11322: No Matching Results in Patchtester

After applied Patch in FTP Port field 1.1e+1 is saved and shown in configuration.php. Same after replacing value with 21 (saved in global configuration and configuration.php).


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

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 10 Jan 2017 - Tested unsuccessfully
avatar zero-24
zero-24 - comment - 10 Jan 2017

@jo-sf same here can you confirm the usage without #11322

avatar jo-sf
jo-sf - comment - 12 Jan 2017

@franz-wohlkoenig @zero-24 my patch will work regardless of PR #11322 but the test instructions are no longer valid. I will look for another test case where my patch makes a difference, and as soon as I've found one I'll come back. Hope that's OK.

avatar jo-sf jo-sf - change - 16 Jan 2017
The description was changed
avatar jo-sf jo-sf - edited - 16 Jan 2017
avatar joomla-cms-bot joomla-cms-bot - change - 16 Jan 2017
Category Administration Components Administration com_config Components
avatar jo-sf
jo-sf - comment - 16 Jan 2017

@franz-wohlkoenig @zero-24 I just updated the test instructions for this PR, it no longer depends upon PR #11322. I hope you can repeat your tests, this time hopefully successful.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 21 Jan 2017

I have tested this item successfully on 0d273d2


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

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 21 Jan 2017 - Tested successfully
avatar zero-24
zero-24 - comment - 21 Jan 2017

I have tested this item successfully on 0d273d2

Works! Thanks

Even if the exponential representation of a numeric value is somewhat esoteric it is valid and it is accepted by modern browsers if the type of the input field is "number". Due to that the validation method for numeric fields should probably be changed such that it not only accepts such values (which is the case today) but also converts them correctly into a number ("1.5e+1" should be converted into "15", not into "1" as is the case today). But this is beyond the scope of this PR.

Sounds good if you have some time it would be great if we can have the needed code as PR to test!


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

avatar zero-24 zero-24 - change - 21 Jan 2017
Milestone Added:
Status Pending Ready to Commit
Labels Added: ?
avatar zero-24 zero-24 - test_item - 21 Jan 2017 - Tested successfully
avatar jo-sf
jo-sf - comment - 22 Jan 2017

@zero-24 About converting values like "1.5e+1" into a number: this is IMO easy to implement by changing the file libraries/joomla/filter/input.php and there the implementation of the method clean(). For the cases "INT" / "INTEGER" and "UINT" the pattern to search for should be replaced with the pattern defined for the "FLOAT" / "DOUBLE" case. Since the match will then be converted into an integer resp. positive integer the result should hold the desired value (so "1.5e+1" would be no longer converted into "1" but instead "15").

If you agree I'd make this a new PR...

avatar rdeutz rdeutz - change - 23 Jan 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-01-23 09:10:29
Closed_By rdeutz
Labels
avatar rdeutz rdeutz - close - 23 Jan 2017
avatar rdeutz rdeutz - merge - 23 Jan 2017
avatar zero-24
zero-24 - comment - 23 Jan 2017

@jo-sf go for it as long it still behaves correct i'm ok with it.

avatar jo-sf
jo-sf - comment - 24 Jan 2017

@zero-24 I created a new PR #13731 for handling the exponential representation of numbers, please have a look.

Add a Comment

Login with GitHub to post a comment