Problem/Motivation
This is a follow-up of #3557142: \Drupal\views\FieldViewsDataProvider::defaultFieldImplementation creates a join for a non-existing table causing deprecations on PHP 8.5 which didn't cover an edge case.
PHP 8.5 deprecation notices are popping up in FieldViewsDataProvider::defaultFieldImplementation() with this (edge case) scenario:
- The entity type lacks a data table
- A configurable field is declared as translatable in the field storage
- At least two bundles are using the field but with different translatability setting: one is declaring it translatable, other non-translatable.
The deprecation notice:
Using null as an array offset is deprecated, use an empty string instead
The "test only" code proves the bug https://git.drupalcode.org/issue/drupal-3582171/-/jobs/9151088
Steps to reproduce
See the new added test.
Proposed resolution
Similar to #3557142: \Drupal\views\FieldViewsDataProvider::defaultFieldImplementation creates a join for a non-existing table causing deprecations on PHP 8.5, check if the data table exists.
Remaining tasks
None.
User interface changes
None.
Introduced terminology
None.
API changes
None.
Data model changes
None.
Issue fork drupal-3582171
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:
Comments
Comment #3
claudiu.cristeaComment #4
claudiu.cristeaComment #5
claudiu.cristeaComment #6
claudiu.cristeaThis is ready for review.
Comment #7
andypostLooks ready for backport to 11.x
Comment #8
claudiu.cristeaThank you. I think it needs main, 11.x and 11.3.x
Comment #9
alexpottMade a small suggestion to improve the reliability of the test coverage if things we're assuming change later.
Comment #10
claudiu.cristeaI've added the suggested assertion. Set to RTBC as it was just one line change which was suggested by a core committer.
Comment #11
alexpottCommitted and pushed 88805fc to main and 8aaa353e96b to 11.x and aa038bbc9b1 to 11.3.x. Thanks!
Backported to 11.3.x as a non-disruptive bug fix.
Comment #18
larowlanThis broke 11.3.x, I'm going to try revert it. Opened an MR for the revert https://git.drupalcode.org/project/drupal/-/merge_requests/15430
Comment #21
larowlanReverted from 11.3.x as the revert MR passed and applies cleanly
Comment #22
godotislateQuick investigation is that #3347842: Deprecate the trusted data concept in configuration was not backported to 11.3.x, and without the change in ViewsViewsHooks, the views data for entity_test_label entity type is empty.
Explanation for the ViewsViewsHooks change originally is in this commit from the MR in that issue: https://git.drupalcode.org/project/drupal/-/merge_requests/6928/diffs?co...
Not sure what next steps should be. Maybe this issue should just not be backported to 11.3.x? Or is it safe just to bring over that specific ViewViewsHook change?
ETA Note that this was already released in 11.3.6.
Comment #25
alexpottCreated a new 11.3.x MR to re-introduce the fix without the test. Given that fix has gone out in 11.3.6 and is in and tested in 11.x and main I think this approach seems ok. Setting to RTBC for either @larowlan or @godotislate to pick up.
Comment #27
catchCommitted/pushed to 11.3.x, thanks!