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

Save as draft - DateTime validation error #7459

Closed
i-just opened this issue Jan 28, 2021 · 4 comments
Closed

Save as draft - DateTime validation error #7459

i-just opened this issue Jan 28, 2021 · 4 comments
Labels

Comments

@i-just
Copy link
Contributor

i-just commented Jan 28, 2021

Description

After updating to Craft 3.5.19 (which contains a fix for #7404 ) whenever I save a draft or try to preview it or view it I get an error ("A server error occurred."). In the logs I can see this:
2021-01-28 15:14:44 [-][1][-][error][ArgumentCountError] ArgumentCountError: Too few arguments to function craft\helpers\DateTimeHelper::toDateTime(), 0 passed in /Library/WebServer/Documents/src/motability/drc/vendor/craftcms/cms/src/validators/DateTimeValidator.php on line 81 and at least 1 expected in vendor/craftcms/cms/src/helpers/DateTimeHelper.php:83

Downgrading to version 3.5.18 solves this problem.

Changing line 81 of vendor/craftcms/cms/src/helpers/DateTimeHelper.php from:
$value = DateTimeHelper::toDateTime();
to
$value = DateTimeHelper::toDateTime($value);
also seems to fix the problem (but I haven't checked any other implications of doing this).

Steps to reproduce

  1. update to Craft 3.5.19
  2. edit any entry and save it as draft
  3. try to view that entry (click on view button)

Additional info

  • Craft version: 3.5.19
  • PHP version: 7.1.23 and 7.2.34
  • Database driver & version: mysql
  • Plugins & versions: n/a
@i-just i-just added the bug label Jan 28, 2021
brandonkelly added a commit that referenced this issue Jan 28, 2021
Cherry picked 619a930 to 3.5

Fixes #7459
@brandonkelly
Copy link
Member

Doh, thanks for pointing that out! Just released 3.5.19.1 with the same fix.

@ghost
Copy link

ghost commented Jan 28, 2021

    • ****

@michtio
Copy link
Contributor

michtio commented Feb 1, 2021

As a mention, this error also happened when indexing assets through the CLI:

Indexing assets in Videos ...
    > #0: 07-Brief-introduction-to-communities-of-practice.pdf ... error: Too few arguments to function craft\helpers\DateTimeHelper::toDateTime(), 0 passed in /home/forge/researchschool.org.uk/releases/30524f031c5077de5b27a3c325a004a283df7466/vendor/craftcms/cms/src/validators/DateTimeValidator.php on line 81 and at least 1 expected

I think it is related, will update Craft and report back if issue has been resolved.

@brandonkelly
Copy link
Member

@michtio Yeah the bug was in DateTimeValidator. 3.5.19.1 will fix that one too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants