-
Notifications
You must be signed in to change notification settings - Fork 40
Description
Description of the bug
During a D7 → B1 migration, I encountered the following error, breaking the migration import:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: http://thensmc.local/core/update.php?op=selection&token=aeynOFF00trJeEvucZj5bu07xcPClxYNAuX3Jqb5YdU&action=update&id=53219&op=do_nojs&op=do
StatusText: Service unavailable (with message)
ResponseText: TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in array_keys() (line 453 of [...]\httpdocs\core\modules\field\field.info.inc).
Steps To Reproduce
- Have / build a Drupal 7 site with the modules below shown
- Attempt to run a complete migration to BackdropCMS 1.
- Run database updates as part of the migration process.
- Fatal error.
Actual behavior
Fatal error, caused by something passing array_keys a null rather than a [].
Expected behavior
No fatal error, migration database update continues uninterrupted.
Additional information
Add any other information that could help, such as:
- Backdrop CMS version: 1.31.2
- Web server and its version: apache 2.4.54
- PHP version: 8.0+ (tested with 8.1)
- Database sever (MySQL or MariaDB?) and its version: MariaDB Version: 10.11.11
- Operating System and its version: Windows 10 22H2
The issue is this line in the _field_info_prepare_extra_fields() function:
$view_modes = array_merge(array('default'), array_keys($entity_type_info['view modes']));There's nothing to guard or check that $entity_type_info['view modes'] both exists and is valid.
This was during an import of an existing D7 site that's quite old (10 years 1 month at the time of writing since the 'administrator' account was created). Here are the modules that are active in the Drupal 7 database:
| Category | Name (machine_name) | Type | Status | Version |
|---|---|---|---|---|
| Administration | Administration menu (admin_menu) | Module | Enabled | 7.x-3.0-rc7 |
| Administration | Administration menu Toolbar style (admin_menu_toolbar) | Module | Enabled | 7.x-3.0-rc7 |
| Chaos tool suite | Chaos tools (ctools) | Module | Enabled | 7.x-1.21 |
| Charts | Charts (charts) | Module | Enabled | 7.x-2.1 |
| Charts | Highcharts (charts_highcharts) | Module | Enabled | 7.x-2.1 |
| Core | Announcements (announcements_feed) | Module | Enabled | 7.102 |
| Core | Block (block) | Module | Enabled | 7.102 |
| Core | Blog (blog) | Module | Enabled | 7.102 |
| Core | Color (color) | Module | Enabled | 7.102 |
| Core | Comment (comment) | Module | Enabled | 7.102 |
| Core | Contextual links (contextual) | Module | Enabled | 7.102 |
| Core | Dashboard (dashboard) | Module | Enabled | 7.102 |
| Core | Database logging (dblog) | Module | Enabled | 7.102 |
| Core | Field (field) | Module | Enabled | 7.102 |
| Core | Field SQL storage (field_sql_storage) | Module | Enabled | 7.102 |
| Core | Field UI (field_ui) | Module | Enabled | 7.102 |
| Core | File (file) | Module | Enabled | 7.102 |
| Core | Filter (filter) | Module | Enabled | 7.102 |
| Core | Help (help) | Module | Enabled | 7.102 |
| Core | Image (image) | Module | Enabled | 7.102 |
| Core | List (list) | Module | Enabled | 7.102 |
| Core | Menu (menu) | Module | Enabled | 7.102 |
| Core | Node (node) | Module | Enabled | 7.102 |
| Core | Number (number) | Module | Enabled | 7.102 |
| Core | Options (options) | Module | Enabled | 7.102 |
| Core | Path (path) | Module | Enabled | 7.102 |
| Core | PHP filter (php) | Module | Enabled | 7.102 |
| Core | RDF (rdf) | Module | Enabled | 7.102 |
| Core | Search (search) | Module | Enabled | 7.102 |
| Core | Shortcut (shortcut) | Module | Enabled | 7.102 |
| Core | System (system) | Module | Enabled | 7.102 |
| Core | Taxonomy (taxonomy) | Module | Enabled | 7.102 |
| Core | Text (text) | Module | Enabled | 7.102 |
| Core | Toolbar (toolbar) | Module | Enabled | 7.102 |
| Core | Update manager (update) | Module | Enabled | 7.102 |
| Core | User (user) | Module | Enabled | 7.102 |
| Date/Time | Date (date) | Module | Enabled | 7.x-2.14 |
| Date/Time | Date API (date_api) | Module | Enabled | 7.x-2.14 |
| Date/Time | Date Popup (date_popup) | Module | Enabled | 7.x-2.14 |
| Date/Time | Date Views (date_views) | Module | Enabled | 7.x-2.14 |
| Features | Features (features) | Module | Enabled | 7.x-2.15 |
| Fields | Entity Reference (entityreference) | Module | Enabled | 7.x-1.10 |
| Fields | Field Collection (field_collection) | Module | Enabled | 7.x-1.2 |
| Fields | Field Group (field_group) | Module | Enabled | 7.x-1.8 |
| Fields | Insert (insert) | Module | Enabled | 7.x-1.5 |
| Fields | Link (link) | Module | Enabled | 7.x-1.13 |
| Location | Location (location) | Module | Enabled | 7.x-3.7 |
| MailChimp | MailChimp (mailchimp) | Module | Enabled | 7.x-5.7 |
| Media | File Entity (file_entity) | Module | Enabled | 7.x-2.40 |
| Media | IMCE (imce) | Module | Enabled | 7.x-1.11 |
| Media | Media (media) | Module | Enabled | 7.x-2.30 |
| Media | Media Field (mediafield) | Module | Enabled | 7.x-2.30 |
| Media | Media Internet Sources (media_internet) | Module | Enabled | 7.x-2.30 |
| Media | Media WYSIWYG (media_wysiwyg) | Module | Enabled | 7.x-2.30 |
| Migration | Migrate (migrate) | Module | Enabled | 7.x-2.12 |
| Other | Backdrop upgrade status (backdrop_upgrade_status) | Module | Enabled | 7.x-1.3 |
| Other | Backup and Migrate (backup_migrate) | Module | Enabled | 7.x-3.10 |
| Other | Block Class (block_class) | Module | Enabled | 7.x-2.4 |
| Other | Breakpoints (breakpoints) | Module | Enabled | 7.x-1.6 |
| Other | Diff (diff) | Module | Enabled | 7.x-3.5 |
| Other | Disqus (disqus) | Module | Enabled | 7.x-1.12 |
| Other | Entity API (entity) | Module | Enabled | 7.x-1.12 |
| Other | Entity tokens (entity_token) | Module | Enabled | 7.x-1.12 |
| Other | EU Cookie Compliance (eu_cookie_compliance) | Module | Enabled | 7.x-1.43 |
| Other | Job Scheduler (job_scheduler) | Module | Enabled | 7.x-2.0 |
| Other | Libraries (libraries) | Module | Enabled | 7.x-2.5 |
| Other | Link checker (linkchecker) | Module | Enabled | 7.x-1.6 |
| Other | Menu Block (menu_block) | Module | Enabled | 7.x-2.9 |
| Other | Pathauto (pathauto) | Module | Enabled | 7.x-1.4 |
| Other | Redirect (redirect) | Module | Enabled | 7.x-1.0-rc4 |
| Other | Site map (site_map) | Module | Enabled | 7.x-1.3 |
| Other | Taxonomy menu (taxonomy_menu) | Module | Enabled | 7.x-1.7 |
| Other | Token (token) | Module | Enabled | 7.x-1.9 |
| Other - OrigamiUSA | Entity Plus [stub] (entity_plus) | Module | Enabled | 7.x-1.0 |
| Other - OrigamiUSA | Entity UI [stub] (entity_ui) | Module | Enabled | 7.x-1.0 |
| Picture | Picture (picture) | Module | Enabled | 7.x-2.14 |
| Spam control | CAPTCHA (captcha) | Module | Enabled | 7.x-1.7 |
| Statistics | Google Analytics (googleanalytics) | Module | Enabled | 7.x-2.8 |
| User interface | jQuery Update (jquery_update) | Module | Enabled | 7.x-4.1 |
| Views | Better Exposed Filters (better_exposed_filters) | Module | Enabled | 7.x-3.6 |
| Views | Views (views) | Module | Enabled | 7.x-3.30 |
| Views | Views block area (views_block_area) | Module | Enabled | 7.x-1.2 |
| Views | Views Bootstrap (views_bootstrap) | Module | Enabled | 7.x-3.5 |
| Views | Views Bulk Operations (views_bulk_operations) | Module | Enabled | 7.x-3.7 |
| Views | Views TimelineJS (views_timelinejs) | Module | Enabled | 7.x-1.1 |
| Views | Views UI (views_ui) | Module | Enabled | 7.x-3.30 |
| Webform | Webform (webform) | Module | Enabled | 7.x-4.27 |
| Webform | Webform AJAX (webform_ajax) | Module | Enabled | 7.x-2.0 |
| Webform | Webform Import (webform_import) | Module | Enabled | 7.x-1.3 |
| XML sitemap | XML sitemap (xmlsitemap) | Module | Enabled | 7.x-2.7 |
| XML sitemap | XML sitemap node (xmlsitemap_node) | Module | Enabled | 7.x-2.7 |
| Core | Bartik (bartik) | Theme | Enabled | 7.102 |
| Core | Seven (seven) | Theme | Enabled | 7.102 |
And here's a list of the entities on the site:
commentfield_collection_itemnoderedirectfiletaxonomy_termtaxonomy_vocabularyuser
Workaround
Here's the change that I made to get the migration to finish:
$array_keys = ( $entity_type_info['view modes'] ?? false ) ?: [];
$view_modes = array_merge([ 'default' ], array_keys($array_keys));However, I'm not familiar with working with entities, so I don't know if any of these are supposed to have no view modes.