Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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) {
..
}
Comment | File | Size | Author |
---|---|---|---|
#2 | feeds_tamper-fix-params-default-value-callback-2567431-2-7.x.patch | 631 bytes | lexbritvin |
Comments
Comment #2
lexbritvin CreditAttribution: lexbritvin commentedHello!
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.
Comment #4
twistor CreditAttribution: twistor as a volunteer commentedComment #6
aminorking CreditAttribution: aminorking commentedIs it possible to get a stable release soon? Would be great to have a php 7 compatible recommended release. Many thanks.
Comment #7
W.M. CreditAttribution: W.M. commentedKindly release a new stable release with the above patch, thank you.
Comment #8
mausolos CreditAttribution: mausolos commentedBumping for "please release new stable release with the above patch" (and thank you, of course).
Comment #9
jay-dee-ess CreditAttribution: jay-dee-ess as a volunteer commentedAgree with #6, 7 and 8.
Comment #10
acke CreditAttribution: acke at Happiness commentedIt would be appreciated with a stable PHP 7 compatible release.
Comment #11
Kris77 CreditAttribution: Kris77 commentedIt work for me too with php 7.
Thanks
Comment #12
grougy CreditAttribution: grougy as a volunteer commentedWorks for me too with PHP 7.0.14 x64
Comment #13
fonant CreditAttribution: fonant at Fonant Ltd commentedConfirming that this patch fixes the fatal error when using PHP 7. Would be good to see a new stable release...
Comment #14
maxplus CreditAttribution: maxplus commentedThanks,
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!
Comment #15
ccjjmartin CreditAttribution: ccjjmartin at Four Kitchens commentedAny 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
Comment #16
mvcComment #17
agudivad CreditAttribution: agudivad as a volunteer commentedBumping for "please release new stable release with the above patch".
Comment #18
DanielVezaLets just bump this again for a stable release.
Comment #19
MegaChriz CreditAttribution: MegaChriz at WebCoo commented@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
Comment #20
DanielVezaOh I apologise! I saw this error pop up on a site today. That site must be on the previous version.