tomasnorre / crawler

Libraries and scripts for crawling the TYPO3 page tree. Used for re-caching, re-indexing, publishing applications etc.
GNU General Public License v3.0
54 stars 84 forks source link

"sofort" could not be parsed by \DateTime constructor #728

Closed Patta closed 3 years ago

Patta commented 3 years ago

Bug Report

Current Behavior After making changes on a page and try to open the crawler info module, an error occurred.

Oops, an error occurred! "sofort" could not be parsed by \DateTime constructor: DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character More information regarding this error might be available online. https://docs.typo3.org/typo3cms/exceptions/master/en-us/Exceptions/1241722579.html

warning.log: [CRITICAL] request="2a055eea54ad5" component="TYPO3.CMS.Core.Error.ProductionExceptionHandler": Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1241722579: "sofort" could not be parsed by \DateTime constructor: DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character | TYPO3Fluid\Fluid\Core\ViewHelper\Exception thrown in file /var/www/vhosts/REMOVED/private/typo3/sysext/fluid/Classes/ViewHelpers/Format/DateViewHelper.php in line 163. Requested URL: https://REMOVED/typo3/index.php?route=%2Fmodule%2Fweb%2Finfo&token=--AnonymizedToken--&id=13980 - {"TYPO3_MODE":"BE","exception":"TYPO3Fluid\\Fluid\\Core\\ViewHelper\\Exception: \"sofort\" could not be parsed by \\DateTime constructor: DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character in /var/www/vhosts/REMOVED/private/typo3/sysext/fluid/Classes/ViewHelpers/Format/DateViewHelper.php:163\ ...

Expected behavior/output After making changes on a page and try to open the crawler info module, the module is visible.

Steps to reproduce

Environment

Possible Solution none

Additional context none

tomasnorre commented 3 years ago

Thank you for your report @Patta, I have a feeling that I have seen this issue before. Would need to dig into it.

Patta commented 3 years ago

Maybe the wrong dates in the crowler log are related?

crawler:buildQueue scheduler for this site is set to 10 4 * * * crawler:processQueue is set to 0 */1 * * *

Screenshot-2021-03-15-092458

rvock commented 3 years ago

Relevant code positions: https://github.com/AOEpeople/crawler/blob/04dfad88f1ab5f1e2b80dd185dea7f4ecd7a2523/Classes/Backend/RequestForm/LogRequestForm.php#L365 https://github.com/AOEpeople/crawler/blob/04dfad88f1ab5f1e2b80dd185dea7f4ecd7a2523/Resources/Private/Templates/Backend/ShowLog.html#L131

The LogRequestForm sets the translated string for now (german: "sofort") as value for $row[scheduled]. The template then feeds that value to the DateTime constructor.

I think the check should be moved from the controller to the view (or the view should always get a formatted time).

tomasnorre commented 3 years ago

@rvock I didn't look into that much yet, but think you are on the right spot. I'll see if I can find some time for it soonish to have a fix released.

I think it's related to the localization as well. That I'm using values that are translated in the select, not only as "label".

tomasnorre commented 3 years ago

@Patta could you please verify that the fix is working for you? Please see PR https://github.com/AOEpeople/crawler/pull/734

Patta commented 3 years ago

@tomasnorre yes, the PR seems to fix this issue.

tomasnorre commented 3 years ago

Thanks for letting me know: I'll release a new version of the crawler one of the next days.