Recent changes from field_group 1.4 to 1.5 have resulted in failing builds on TravisCI for PHP7.

<   'group_bean_highlight|bean|highlight|default' => array(
<     'api_version' => 1,
<     'bundle' => 'highlight',
<     'data' => array(
<       'children' => array(
<         0 => 'field_bean_highlight_description',
<         1 => 'field_bean_highlight_image',
<       ),
<       'format_settings' => array(
...
<   ),
<   'group_bean_slide_caption|field_collection_item|field_bean_slide_collection|default' => array(

---

>   '' => array(

PHP7 changed their Uniform Variable Syntax (according to this section of a PHP7 reference document). After updating the offending section inside _field_group_get_default_formatter_settings() inside field_group.module, my exports inside my features packages were working again.

From the document: Code that relied upon the old evaluation order must be rewritten to explicitly use that evaluation order with curly braces (see middle column of the above). This will make the code both forwards compatible with PHP 7.x and backwards compatible with PHP 5.x

CommentFileSizeAuthor
#5 php7_uniform_variable-2649648-5.patch1.14 KBsylus
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sylus created an issue. See original summary.

sylus’s picture

sylus’s picture

Issue summary: View changes
sylus’s picture

Issue summary: View changes
sylus’s picture

Status: Active » Needs review
FileSize
1.14 KB

Attaching patch.

Tess Bakker’s picture

Status: Needs review » Reviewed & tested by the community

Nice patch, works!

Tess Bakker’s picture

Priority: Normal » Major
seanB’s picture

This was bugging me as well. I have to switch to PHP5 to get my features exported or else I will lose my fieldgroups.
Patch works! +1

MrHaroldA’s picture

SylvainM’s picture

#5 works fine for me too, thx

heddn’s picture

I had the exact same patch in #2661484: field_group_field_group_to_hook_code PHP 7 support. So +1 on RTBC.

nils.destoop’s picture

Status: Reviewed & tested by the community » Fixed

Thx for the patch. Committed it to dev.

  • zuuperman committed bbf4fd7 on 7.x-1.x authored by sylus
    Issue #2649648 by sylus: PHP7 - Uniform Variable Syntax updates are...

Status: Fixed » Closed (fixed)

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

klausi’s picture

Issue tags: +PHP 7.0 (duplicate)
marcoka’s picture

error fixed. thank you.

giupenni’s picture

Fixed, thank you

When new stable release?

aminorking’s picture

Any news on getting a stable release for this?

dman’s picture

A tagged release would be nice.
Thanks.

interestingaftermath’s picture

Confirmed this worked for me to fix the Features Overridden issue. Tagged release! :)

yasir.arefin’s picture

Fixed, Thanks.

oriol_e9g’s picture

Same problem with Features Overridden and the patch fixes the noticies.

Pete B’s picture

Is there anthing blocking a stable release containing this and https://www.drupal.org/node/2318197 both of which are RTBC? I am willing to help get a stable release out.

owenbush’s picture

Tested this patch today on 7.x-1.5

It worked as expected and I had no further issues.

pingevt’s picture

This worked for me!

edwin.van.buuringen’s picture

Patch works for php 7.1.1, thnx!

rivimey’s picture

Bump... stable release please as per #23?
Just hit this problem myself.

alexrayu’s picture

This is a critical thing, features lose fieldgroups without it. Please include in a stable release!
I only have two pending issues - Global Warming and this.

wylbur’s picture

There's an open issue calling for a stable release.
https://www.drupal.org/node/2869084

donquixote’s picture

-    $code .= "  \${$export['identifier']}s['" . check_plain($object->$export['key']) . "'] = \${$export['identifier']};\n\n";
+    $code .= "  \${$export['identifier']}s['" . check_plain($object->{$export['key']}) . "'] = \${$export['identifier']};\n\n";

It seems this does fix the problem.
But I would recommend using local variables for clarity instead, e.g. for $identifier = $export['identifier'];.