Problem
I just tried upgrading from Drupal 11.1.8 to 11.2.0.
composer update went smoothly.
However, drush updatedb did not go well.
I got the following message on the update block_post_update_set_menu_block_depth_to_null_if_zero database update:
Error: Call to undefined method Drupal\datetime\DateTimeViewsHelper::fieldViewsDataHelper() in datetime_type_field_views_data_helper() (line 39 of /var/www/rouen.fr/app/core/modules/datetime/datetime.module)
Looking in the offending file https://github.com/drupal/drupal/blob/11.x/core/modules/datetime/datetime.module, it is specified that:
"datetime_type_field_views_data_helper() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use \Drupal::service(\‘datetime.views_helper\’)->fieldViewsDataHelper($field_storage, $data, $column_name). See https://www.drupal.org/node/3489502."
But when I look for the fieldViewsDataHelpermethod, it does not appear anywhere!
However, there is a method called fieldViewsData in the file https://github.com/drupal/drupal/blob/11.x/core/modules/datetime/src/Hook/DatetimeViewsHooks.php
Could this be an error in the update code?
Steps to reproduce
From a Drupal 11.1.8:
composer update
drush updatedb
Issue fork drupal-3531044
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3531044-unknown-fieldviewsdatahelper-method
changes, plain diff MR !12414
Comments
Comment #2
nicxvan commentedI think we updated the method name but forgot the deprecation: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/datet...
That and the comment probably needs to be updated to call the method in the helper.
Comment #3
nicxvan commentedhttps://www.drupal.org/project/drupal/issues/3489415 is the issue where this was added.
Comment #5
godotislateComment #6
nicxvan commentedYes it should call buildViewsData
Comment #8
nicxvan commentedThis was the intended replacement.
Confirmed by finding and reviewing the original issue.
I don't think this needs a test under the new policy.
Not 100% sure on critical, but it seems appropriate.
Only remaining mystery is how the update hook hit this, I suspect a custom or contrib hook implementation called the helper directly.
Comment #11
catchYes @zigazou if you find out which module was calling this function, that would be useful information to add here - can either get a backtrace or grep your local code base.
Either way the bug itself is obvious if not how it was triggered. Committed/pushed to 11.x and cherry-picked to 11.2.x, thanks!