I receive the following error when attempting to import a view from a development site (clone) to production site:
Notice: Trying to get property of non-object in views_ui_import_validate() (line 2038 of views/includes/admin.inc).
I suspect this is related to PHP 7.1. I have attempted to define "$test = array();" at the beginning of views_ui_import_validate() function, which moves the error to line 2039. I then change "$view = '';" to "$view = array();", which results in no errors, but the view is not listed following the import. The import seems to die without triggering an error in the UI, apache logs, or watchdog.
Any suggestions?
My environment:
Drupal 7.55
Views 7.x-3.16
CentOS 7
PHP 7.1
MySQL 5.5 (MariaDB 10.1)
Comment | File | Size | Author |
---|---|---|---|
#3 | views-php7_missing_property_check-2890847-3.patch | 334 bytes | szeidler |
|
Comments
Comment #2
keramsey CreditAttribution: keramsey commentedHere is the export of the view FWIW:
$view = new view();
$view->name = 'data_catalog';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'search_api_index_data_set_index';
$view->human_name = 'New Data Catalog';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'New Data Catalog';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['reset_button'] = TRUE;
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '25';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Header: Global: Result summary */
$handler->display->display_options['header']['result']['id'] = 'result';
$handler->display->display_options['header']['result']['table'] = 'views';
$handler->display->display_options['header']['result']['field'] = 'result';
/* Footer: Global: Result summary */
$handler->display->display_options['footer']['result']['id'] = 'result';
$handler->display->display_options['footer']['result']['table'] = 'views';
$handler->display->display_options['footer']['result']['field'] = 'result';
/* Field: Indexed Node: Node ID */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['exclude'] = TRUE;
$handler->display->display_options['fields']['nid']['separator'] = '';
$handler->display->display_options['fields']['nid']['link_to_entity'] = 0;
/* Field: Global: View */
$handler->display->display_options['fields']['view']['id'] = 'view';
$handler->display->display_options['fields']['view']['table'] = 'views';
$handler->display->display_options['fields']['view']['field'] = 'view';
$handler->display->display_options['fields']['view']['label'] = '';
$handler->display->display_options['fields']['view']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['view']['view'] = 'new_lter_data_catalog';
$handler->display->display_options['fields']['view']['display'] = 'page';
$handler->display->display_options['fields']['view']['arguments'] = '[!nid]';
/* Sort criterion: Indexed Node: Title */
$handler->display->display_options['sorts']['title']['id'] = 'title';
$handler->display->display_options['sorts']['title']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['sorts']['title']['field'] = 'title';
/* Filter criterion: Indexed Node: Status */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = array(
1 => '1',
);
/* Filter criterion: Search: Fulltext search */
$handler->display->display_options['filters']['search_api_views_fulltext']['id'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['search_api_views_fulltext']['field'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['exposed'] = TRUE;
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator_id'] = 'search_api_views_fulltext_op';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['label'] = 'Fulltext search';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator'] = 'search_api_views_fulltext_op';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['identifier'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['remember'] = TRUE;
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['remember_roles'] = array(
2 => '2',
3 => 0,
1 => 0,
457 => 0,
458 => 0,
487 => 0,
479 => 0,
485 => 0,
486 => 0,
466 => 0,
452 => 0,
482 => 0,
480 => 0,
6 => 0,
4 => 0,
5 => 0,
470 => 0,
460 => 0,
462 => 0,
464 => 0,
469 => 0,
478 => 0,
483 => 0,
481 => 0,
484 => 0,
);
/* Filter criterion: Indexed Node: Data set ID */
$handler->display->display_options['filters']['field_data_set_id']['id'] = 'field_data_set_id';
$handler->display->display_options['filters']['field_data_set_id']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['field_data_set_id']['field'] = 'field_data_set_id';
$handler->display->display_options['filters']['field_data_set_id']['operator'] = '<>';
/* Filter criterion: Indexed Node: Related projects */
$handler->display->display_options['filters']['field_related_projects']['id'] = 'field_related_projects';
$handler->display->display_options['filters']['field_related_projects']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['field_related_projects']['field'] = 'field_related_projects';
$handler->display->display_options['filters']['field_related_projects']['operator'] = 'not empty';
/* Display: Data Catalog */
$handler = $view->new_display('page', 'Data Catalog', 'page_2');
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter criterion: Indexed Node: Status */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = array(
1 => '1',
);
/* Filter criterion: Search: Fulltext search */
$handler->display->display_options['filters']['search_api_views_fulltext']['id'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['search_api_views_fulltext']['field'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['exposed'] = TRUE;
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator_id'] = 'search_api_views_fulltext_op';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['label'] = 'Fulltext search';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator'] = 'search_api_views_fulltext_op';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['identifier'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['remember'] = TRUE;
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['remember_roles'] = array(
2 => '2',
3 => 0,
1 => 0,
457 => 0,
458 => 0,
487 => 0,
479 => 0,
485 => 0,
486 => 0,
466 => 0,
452 => 0,
482 => 0,
480 => 0,
6 => 0,
4 => 0,
5 => 0,
470 => 0,
460 => 0,
462 => 0,
464 => 0,
469 => 0,
478 => 0,
483 => 0,
481 => 0,
484 => 0,
);
/* Filter criterion: Indexed Node: Data set ID */
$handler->display->display_options['filters']['field_data_set_id']['id'] = 'field_data_set_id';
$handler->display->display_options['filters']['field_data_set_id']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['field_data_set_id']['field'] = 'field_data_set_id';
$handler->display->display_options['filters']['field_data_set_id']['operator'] = '<>';
$handler->display->display_options['path'] = 'lter/data_catalog';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'Data Catalog';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['name'] = 'management';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['menu']['context_only_inline'] = 0;
$handler->display->display_options['tab_options']['type'] = 'tab';
$handler->display->display_options['tab_options']['title'] = 'Data Catalog';
$handler->display->display_options['tab_options']['weight'] = '0';
$handler->display->display_options['tab_options']['name'] = 'management';
/* Display: Datasets */
$handler = $view->new_display('page', 'Datasets', 'page');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = 'Datasets';
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter criterion: Indexed Node: Status */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = array(
1 => '1',
);
/* Filter criterion: Search: Fulltext search */
$handler->display->display_options['filters']['search_api_views_fulltext']['id'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['search_api_views_fulltext']['field'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['exposed'] = TRUE;
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator_id'] = 'search_api_views_fulltext_op';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['label'] = 'Fulltext search';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator'] = 'search_api_views_fulltext_op';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['identifier'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['remember'] = TRUE;
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['remember_roles'] = array(
2 => '2',
3 => 0,
1 => 0,
457 => 0,
458 => 0,
487 => 0,
479 => 0,
485 => 0,
486 => 0,
466 => 0,
452 => 0,
482 => 0,
480 => 0,
6 => 0,
4 => 0,
5 => 0,
470 => 0,
460 => 0,
462 => 0,
464 => 0,
469 => 0,
478 => 0,
483 => 0,
481 => 0,
484 => 0,
);
/* Filter criterion: Indexed Node: Data set ID */
$handler->display->display_options['filters']['field_data_set_id']['id'] = 'field_data_set_id';
$handler->display->display_options['filters']['field_data_set_id']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['field_data_set_id']['field'] = 'field_data_set_id';
$handler->display->display_options['filters']['field_data_set_id']['operator'] = '<>';
$handler->display->display_options['path'] = 'lter/data_catalog/datasets';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'Datasets';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['menu']['context_only_inline'] = 0;
$handler->display->display_options['tab_options']['weight'] = '0';
/* Display: Projects */
$handler = $view->new_display('page', 'Projects', 'page_1');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = 'Projects';
$handler->display->display_options['defaults']['relationships'] = FALSE;
/* Relationship: Related projects: Related projects (indexed) */
$handler->display->display_options['relationships']['field_related_projects_field_related_projects']['id'] = 'field_related_projects_field_related_projects';
$handler->display->display_options['relationships']['field_related_projects_field_related_projects']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['relationships']['field_related_projects_field_related_projects']['field'] = 'field_related_projects_field_related_projects';
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: Indexed Node: Node ID */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['exclude'] = TRUE;
$handler->display->display_options['fields']['nid']['separator'] = '';
$handler->display->display_options['fields']['nid']['link_to_entity'] = 0;
/* Field: Global: View */
$handler->display->display_options['fields']['view']['id'] = 'view';
$handler->display->display_options['fields']['view']['table'] = 'views';
$handler->display->display_options['fields']['view']['field'] = 'view';
$handler->display->display_options['fields']['view']['label'] = '';
$handler->display->display_options['fields']['view']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['view']['view'] = 'jornada_projects';
$handler->display->display_options['fields']['view']['display'] = 'page_projects';
$handler->display->display_options['fields']['view']['arguments'] = '[!nid]';
$handler->display->display_options['fields']['view']['query_aggregation'] = TRUE;
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter criterion: Indexed Node: Status */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'search_api_index_data_set_index';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = array(
1 => '1',
);
$handler->display->display_options['path'] = 'lter/data_catalog/prjs';
$handler->display->display_options['menu']['title'] = 'Projects';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['menu']['context_only_inline'] = 0;
/* Display: Facets block: LTER Core Area */
$handler = $view->new_display('search_api_views_facets_block', 'Facets block: LTER Core Area', 'search_api_views_facets_block_lter_core_area');
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['linked_path'] = 'lter/ken-facet-test';
$handler->display->display_options['facet_field'] = 'field_taxonomy_lter_core_areas';
$handler->display->display_options['hide_block'] = 1;
Comment #3
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedI also experience the issue with PHP 7.1. The notice only occurs, when the view gets imported the first time, or was deleted and cache-cleared.
Steps to reproduce:
Proposed resolution
$test
in line 2038 inviews/includes/admin.inc
is NULL, because a non-existing view could not be loaded.So I would suggest to do a proper check, if the object is not null or the property
$test->vid
exists, via anisset()
or!empty()
.Comment #4
svouthi CreditAttribution: svouthi commentedI receive the same notice when importing a view using Views version 7.x-3.18 with PHP 5.6.40.
Comment #5
renatogHello @keramsey how are you?
Thank you so much for reporting that.
@szeidler thanks a lot for your solution on #3 it really makes sense for me. So moving to RTBC
@svouthi and @keramsey, could you see if this patch solve for you as well, please?
Thank you so much in advance
Comment #6
DamienMcKennaIt's a small but valid fix.
Comment #7
DamienMcKennaCommitted. Thank you.