Skip to content

Commit

Permalink
Issue #3131122 by dpi: PHP 7.4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dpi committed Apr 27, 2020
1 parent 9d720e8 commit ae15f54
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Provider/PhoneNumberVerification.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Utility\Token;
use Drupal\sms\Direction;
use Drupal\sms\Exception\PhoneNumberSettingsException;
Expand Down Expand Up @@ -181,8 +182,8 @@ public function updatePhoneVerificationByEntity(EntityInterface $entity) {
$phone_number_settings = $this->getPhoneNumberSettingsForEntity($entity);
$field_name = $phone_number_settings->getFieldName('phone_number');
if (!empty($field_name)) {
$items_original = &$entity->original->{$field_name};
$items = &$entity->{$field_name};
$items_original = isset($entity->original) ? $entity->original->{$field_name} : NULL;
$items = $entity->{$field_name};
}
}
catch (PhoneNumberSettingsException $e) {
Expand All @@ -196,7 +197,8 @@ public function updatePhoneVerificationByEntity(EntityInterface $entity) {
}

$numbers = [];
foreach ($items as &$item) {
assert($items instanceof FieldItemListInterface);
foreach ($items as $item) {
$phone_number = $item->value;
$numbers[] = $phone_number;

Expand Down

0 comments on commit ae15f54

Please sign in to comment.