Inside:
/plugins/default_value.inc

New in PHP7:

Function parameters with duplicate name are not allowed anymore. Definitions like “function foo($x,$x) {}” will lead to compile time error.

As it in fact happens under PHP 7 due to this:

function feeds_tamper_default_value_callback($source, $item_key, $element_key, &$field, $settings, $source) {
  // Setting a default value.
  if (!empty($settings['only_if_empty']) && !$field) {
    $field = $settings['default_value'];
  }
  elseif (empty($settings['only_if_empty'])) {
    $field = $settings['default_value'];
  }
}

As a quick but not fully tested fix I change the function parameters to this:

function feeds_tamper_default_value_callback($source, $item_key, $element_key, &$field, $settings, $source_2) {
..
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

W.M. created an issue. See original summary.

lexbritvin’s picture

Status: Active » Needs review
FileSize
631 bytes

Hello!

Having the same issue on PHP7 using php7.0-fpm.

According to other tamper plugins, seems like there is a mistake in parameters, it's not only PHP7 compatibility issue - the 1st parameter $source should be $result.
Simple patch fixes the problem.

  • twistor committed e310053 on 7.x-1.x authored by LexBritvin
    Issue #2567431 by LexBritvin: [PHP 7 Compatibility] case:...
twistor’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

aminorking’s picture

Is it possible to get a stable release soon? Would be great to have a php 7 compatible recommended release. Many thanks.

W.M.’s picture

Kindly release a new stable release with the above patch, thank you.

mausolos’s picture

Bumping for "please release new stable release with the above patch" (and thank you, of course).

jay-dee-ess’s picture

Agree with #6, 7 and 8.

acke’s picture

It would be appreciated with a stable PHP 7 compatible release.

Kris77’s picture

It work for me too with php 7.

Thanks

grougy’s picture

Works for me too with PHP 7.0.14 x64

fonant’s picture

Confirming that this patch fixes the fatal error when using PHP 7. Would be good to see a new stable release...

maxplus’s picture

Thanks,
this really saved a lot of lost time.
I could not find why my importers on my new webhosting where failing with ajax errors
=> finding this issue and switching between php 5.6 and 7.1 exposed this problem for me

Many thanks for this patch!

ccjjmartin’s picture

Any reason not to do a version bump to the module for this? With the latest release of the feeds module a lot of attention is going to be given to making sure existing feeds are working: https://www.drupal.org/project/feeds

mvc’s picture

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

Bumping for "please release new stable release with the above patch".

DanielVeza’s picture

Lets just bump this again for a stable release.

MegaChriz’s picture

@DanielVeza
This has already been included in a stable release (more than a year ago):
https://www.drupal.org/project/feeds_tamper/releases/7.x-1.2

DanielVeza’s picture

Oh I apologise! I saw this error pop up on a site today. That site must be on the previous version.