-
Notifications
You must be signed in to change notification settings - Fork 340
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
DateMalformedStringException - Failed to parse time string (Ymd) at position 0 (Y) in module-elasticsuite-indices/Model/IndexStatusProvider.php:120 #3403
Comments
Second param does not make any sense as well:
then:
so
Why not just:
I don't know yet why this maybe deprecated method is being called in our case within latest module version but we suppose it stops our indexes from scheduled updates. |
…building check
I've just received confirmation that indexes are working as expected after these changes 🤷♂️ Here's our patch:
|
Hello @Tomasz-Silpion, I was not able to reproduce your issue with your steps to reproduce on the fresh Magento 2.4.7 CE/EE (Prod mode) with PHP 8.2.24/8.3.12, Elasticsearch 7.17.21 and with installed Elasticsuite 2.11.9. After running Could you provide which Indices Name Pattern you are using in your environment? BR, |
They are default ones:
No idea what triggers the
calls are invalid? https://www.php.net/manual/en/class.datetime.php Construct time needs to be specified time string instead format or DateTime object. |
…-format Fix #3403 DateTime constructor in IndexStatusProvider
Preconditions
Rocky Linux release 9.4 (Blue Onyx), PHP 8.3.10, Elasticsearch 7.17.9
Magento Version : CE 2.4.7
ElasticSuite Version : 2.11.9
Environment : Production Mode
Third party modules : Yes. Too many and that's confidential.
Steps to reproduce
php bin/magentoindexer:reset catalogsearch_fulltext && php bin/magento indexer:reindex catalogsearch_fulltext
tail -n 200 var/log/exception.log
Expected result
Actual result
[2024-10-03T14:12:30.202727+00:00] main.ERROR: Error when loading/parsing statistics for index "magento2_default_catalog_category_20240729_111506" {"exception":"[object] (DateMalformedStringException(code: 0): Failed to parse time string (Ymd) at position 0 (Y): The timezone could not be found in the database at vendor/smile/elasticsuite/src/module-elasticsuite-indices/Model/IndexStatusProvider.php:120)"} []
is visible.$today = new DateTime('Ymd');
line was introduced in https://github.com/Smile-SA/elasticsuite/blame/2.11.x/src/module-elasticsuite-indices/Model/IndexStatusProvider.php#L120C18-L120C50 within Zend libraries removal in #2818 but that line doesn't actually make any sense.According to https://www.php.net/manual/en/class.datetime.php DateTime class should be called with $datetime string not the format (e.g.
new DateTime(''now')
ornew DateTime('20231003')
Calling DateTime class with param Ymd is an obvious bug non compatible with any previous PHP version.
The text was updated successfully, but these errors were encountered: