Since currently the views version is a string rather than a float, the $view->export() methods outputs code that leads to a notice when evaluated, and likewise to a slightly wrong $view object.

Notice: Use of undefined constant alpha1 - assumed 'alpha1' in …/views/includes/view.inc : eval()'d code on line 8

The attached patch should fix the problem.

Comments

drunken monkey’s picture

Version: 6.x-3.0-alpha3 » 6.x-3.x-dev
StatusFileSize
new985 bytes

Sorry, had the wrong version.
But bug exists in DRUPAL-7--3 branch, too. See attached ported patch.

dawehner’s picture

Version: 6.x-3.x-dev » 6.x-3.0-alpha3
StatusFileSize
new624 bytes

#666920: Use views_api_version for exports Did already exist.

I'm wondering whether we really have to check whether the api version is a string, or not.

Views uses this information together with http://php.net/version_compare
This method expects a string so we don't have to distinct here.

But the rest of the patch looks fine.

webchick’s picture

Status: Needs review » Reviewed & tested by the community

Ran into this in #811102: Small mistake in the function group_views_default_views() .

Before patch:

$view = new view;
$view->name = 'group_list';
$view->description = 'Show active groups that are nodes';
$view->tag = 'group';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 3.0-alpha1;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
...

After the patch:

$view = new view;
$view->name = 'group_list';
$view->description = 'Show active groups that are nodes';
$view->tag = 'group';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
...

I re-saved over the old group.views_default.inc, no more errors!

RTBC to me.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Works for me. Committed to all branches. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.