Skip Navigation

Views Compatibility Issue With PHP 7

Resolved

Reported for: Toolset Views 1.11.1

Resolved in: Toolset Views 1.12

Symptoms

When using Views plugin in the PHP 7 powered environment, there is an fatal PHP error:

PHP Fatal error: ‘break’ not in the ‘loop’ or ‘switch’ context in …/wp-content/plugins/wp-views/embedded/toolset/toolset-common/toolset-forms/lib/adodb-time.inc.php on line 1012

There might be also some PHP notices:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Toolset_Regex has a deprecated constructor in …/wp-content/plugins/wp-views/embedded/toolset/toolset-common/expression-parser/parser.php on line 30
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Toolset_Regex has a deprecated constructor in …/wp-content/plugins/wp-views/embedded/toolset/toolset-common/expression-parser/parser.php on line 97
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Toolset_Regex has a deprecated constructor in …/wp-content/plugins/wp-views/embedded/toolset/toolset-common/expression-parser/parser.php on line 1565

The same PHP error and notices can be experienced when working with other Toolset plugins, such as Types or CRED, with error logs pointing to their paths.

In addition, Content Templates might not work, returning unexpected results when assigned to posts or loaded using a wpv-post-body shortcode.
 

Workaround

This issue will be fixed in the upcoming release of Views, as well as upcoming releases for Types and CRED.

Until then, you can download this file, extract it and apply the patch it contains in all those three Toolset plugins, replacing the files with the same names in the following locations:

  • For Types 1.8.11, you need to override the files …/wp-content/plugins/types/embedded/common/toolset-forms/lib/adodb-time.inc.php and …/wp-content/plugins/types/embedded/common/expression-parser/parser.php.
  • For Views 1.11.1, you need to override the files …/wp-content/plugins/wp-views/embedded/toolset/toolset-common/toolset-forms/lib/adodb-time.inc.php and …/wp-content/plugins/wp-views/embedded/toolset/toolset-common/expression-parser/parser.php.
  • For CRED 1.4.2.2, you need to override the files …/wp-content/plugins/cred-frontend-editor/embedded/toolset/toolset-common/toolset-forms/lib/adodb-time.inc.php and …/wp-content/plugins/cred-frontend-editor/embedded/toolset/toolset-common/expression-parser/parser.php.

In addition, the issue with Content Templates can be fixed using this file. Extract it and apply the patch it contains by replacing the file with the same name located in …/wp-content/plugins/wp-views/embedded/inc/views-templates/wpv-template.class.php.

10 thought on Views Compatibility Issue With PHP 7

  • I have installed Types, but able to use this workaround since it refers to Views and not Types, but I am directed here for at temp solution? What am I missing?

    • This workaround is for Views plugin. We’re still working on Types issues with PHP7 and will post about them separately.

  • Hi, This doesn’t fix everything, looks like there’s an error with processing shortcodes as well, all the widgets on the front page that are rendered using do_shortcode don’t work, content templates that use shortcodes inside them also don’t work.

    When can we expect a proper hot fix for these items?

    Thanks

  • Hi Nathan

    This is Juan, lead Views developer. Yes, we noticed a couple of extra issues related to php7, especially regarding Content Templates, and will have a fix for them soon too. I will update this errata with extended instructions once our fix is completed and tested.

    We are not aware of issues related to widgets and/or problems with do_shortcode. I would be very thankfull if you could create a ticket in our support forum about those, providing as much info as you can (what you did, what you expected, what happened) and asking for the support people to ping me about them.

    Thanks in advance.

    • Hi Juan,

      Thanks for the response, on further investigations it seems to be more around content templates not working rather than the shortcodes. Sliders that use content templates are coming up blank, CPT’s that use content templates are also coming up blank.

      Doesn’t seem to be related to the contents of the content template.

      Any ideas on a hotfix for this?

      Thanks

      • Only other thought is I use a lot of custom shortcodes but Views that don’t use content templates are working fine.

  • Hi Nathan.

    I just updated the errata with another zip containing a patch for the issue on Content Templates. Please give it a try and let me know whether this solves the issue.

    Regards.

Comments are closed