You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enter an EDTF date interval in the form YYYY-MM/YYYY-MM, e.g. "1960-01/1960-02"
Attempt to parse it using controlled_access_terms\EDTFUtils::iso8601Value. Example:
drush ev 'print_r(\Drupal\controlled_access_terms\EDTFUtils::iso8601Value("1960-02/1960-03"));'
[warning] Undefined array key 3 EDTFUtils.php:344
T00:00:00%
It throws a php warning, and returns an invalid ISO 8601 date string "T00:00:00%"
We found this problem in our own custom code that attempts to parse values of an EDTF date field in a search_api processor.
I have not encountered other cases that produce wonky results, but I'm guessing there are some.
When does this issue occur?
Any place that tries to convert and EDTF date to ISO8601:
In the controlled_access_terms module, I see this in the following hook implementations: controlled_access_terms_jsonld_alter_normalized_array(), controlled_access_terms_tokens()
Any related open or closed issues to this bug report?
Dumb question: why don't we use professional-wiki/edtf's EDTF date parsing and conversion to do this? (We use EDTF\EdtfFactory::newParser() in \Drupal\controlled_access_terms\Plugin\search_api\processor\EDTFYear, but nowhere else that I can see.)
Thanks for reporting the bug; yes, we should fix it.
Not a dumb question at all. The short answer is, most of the module was written before Professional Wiki's. I've wanted to replace chunks of our code with it for some time to reduce our tech-debt, but simply haven't had the time or need to do so yet. PRs to do so are welcome.
What steps does it take to reproduce the issue?
YYYY-MM/YYYY-MM
, e.g. "1960-01/1960-02"controlled_access_terms\EDTFUtils::iso8601Value
. Example:When does this issue occur?
controlled_access_terms_jsonld_alter_normalized_array()
,controlled_access_terms_tokens()
Any related open or closed issues to this bug report?
The text was updated successfully, but these errors were encountered: