We're seeing a problem with RequestTranslationSubscriber.php under PHP7 when uploading content. We get the following error:

ResponseText: Error: Cannot pass parameter 3 by reference in Drupal\tmgmt_smartling\EventSubscriber\RequestTranslationSubscriber->onUploadRequest() (line 42 of /var/www/pin_business/docroot/modules/contrib/tmgmt_smartling/src/EventSubscriber/RequestTranslationSubscriber.php).

Looking at that code, the link is question is:

      \Drupal::moduleHandler()->alter('tmgmt_smartling_context_url', $url, clone $item);

where the third parameter goes to a reference variable.

This would work without complaint under PHP5, but under PHP7 it causes a fatal error.

A bit of variable juggling makes this work:

      $cloned_item = clone $item;
      \Drupal::moduleHandler()->alter('tmgmt_smartling_context_url', $url, $cloned_item);

Comments

timcosgrove created an issue. See original summary.

timcosgrove’s picture

Attached resolves the issue for us.

gg4’s picture

Status: Active » Needs review

LGTM, but I am probably too close to the fix to RBTC.

  • Loparev committed 0f81182 on 8.x-2.x authored by timcosgrove
    Issue #2923912 by timcosgrove: Object clone passed directly to reference...
loparev’s picture

Thank you, @timcosgrove and @bonus.

loparev’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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