Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Admin => Misc" - Fix validation of "Maximum File Size" #19382

Merged
merged 2 commits into from
Jan 15, 2021

Conversation

totten
Copy link
Member

@totten totten commented Jan 14, 2021

Overview

The form "Administer => System Settings => Miscellaneous" has a field for "Maximum File Size".

I was on a workstation where the PHP-default and the Civi-default were disagreeable, so
(by default) I couldn't submit the form, which forced me to notice some quirks in the validation.

Before

Screen Shot 2021-01-13 at 7 46 10 PM

  • The error message tells you that the "Maximum File Size" disagrees with a setting in php.ini. Hopefully, you have SSH access so you can find and read PHP.ini (sic)... otherwise you'll be at a loss for what value is acceptable.
  • The validation assumes that upload_max_filesize is expressed in unit-megabytes. But php.ini actually
    allows different units (2m, 2048k, 1g, 2097152). The comparison is incorrect
    if any other unit is used. (ex: If php.ini has upload_max_filesize=1g, and if the requested
    limit is 2 megabytes, then it should accept - but it rejects due to mismatched units.)

After

Screen Shot 2021-01-13 at 7 45 40 PM

  • Error message tells you what you need to know. Capitalization is correct.
  • Validator correctly interprets the units used in php.ini's upload_max_filesize.

The form "Administer => System Settings => Miscellaneous" has a field for "Maximum File Size".

I was on a workstation where the PHP-default and the Civi-default were disagreeable, so
(by default) I couldn't submit the form. So I noticed some quirks -- fixed below.

Before
------

* The error message tells you that the "Maximum File Size" disagrees with a setting in `php.ini`.
  Hopefully, you know what+where of "php.ini", otherwise you'll be at a loss for what value is acceptable.
* The validation assumes that `upload_max_filesize` is expressed in unit-megabytes. But `php.ini` actually
  allows different units (`2m`, `2048k`, `1g`, `2097152`). The comparison is incorrect
  if any other unit is used. (ex: If `php.ini has `upload_max_filesize=1g`, and if the requested
  limit is `2` megabytes, then it should accept - but it rejects due to mismatched units.)

After
-----

* Error message tells you what you need to know.
* Validator correctly interprets the units used in `php.ini`'s `upload_max_filesize`.
@civibot
Copy link

civibot bot commented Jan 14, 2021

(Standard links)

@civibot civibot bot added the master label Jan 14, 2021
@eileenmcnaughton
Copy link
Contributor

test this please

@demeritcowboy
Copy link
Contributor

  • General standards
    • [r-explain] PASS
    • [r-user] PASS
    • [r-doc] PASS
    • [r-run] PASS
  • Developer standards
    • [r-tech] PASS
    • [r-code] Strangeness
      • Odd use of escaped quotes? And there's an extra space before the period at the end.
    • [r-maint] ____
    • [r-test] PASS
      • I also have a "webtest" that happens about once a week where I go to change something on dmaster.demo and I forget the default on this page there is 3 but php.ini on the demo server has 2, so I inadvertently do a basic test of the error message. I haven't put up a ticket to fix that because it's kind of good as a test, although the casual user might find it odd.

@eileenmcnaughton
Copy link
Contributor

& @totten can you check @demeritcowboy's comment re quotes & comma & merge once addressed

@totten
Copy link
Member Author

totten commented Jan 14, 2021

[T]here's an extra space before the period at the end.

Thanks. Fixed. ✅

@eileenmcnaughton eileenmcnaughton merged commit b775bf7 into civicrm:master Jan 15, 2021
@totten totten deleted the master-maxfile branch January 15, 2021 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants