Commit 0f49a1ce authored by Lyndon Cox's avatar Lyndon Cox Committed by Youri van Koppen
Browse files

Issue #3306211 by MegaChriz, lind101, coaston: Fixed PHP 8 deprecation: do not pass null to trim().

parent f42cd0d0
Loading
Loading
Loading
Loading
+1 −1
Changes for src/Feeds/Target/Boolean.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ class Boolean extends FieldTargetBase {
   * {@inheritdoc}
   */
  protected function prepareValue($delta, array &$values) {
    $values['value'] = (int) (bool) trim($values['value']);
    $values['value'] = is_string($values['value']) ? (int) (bool) trim($values['value']) : (int) FALSE;
  }

}
+1 −1
Changes for src/Feeds/Target/ConfigEntityReference.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ class ConfigEntityReference extends FieldTargetBase implements ConfigurableTarge
    // Hack to find out the target delta.
    foreach ($form_state->getValues() as $key => $value) {
      if (strpos($key, 'target-settings-') === 0) {
        list(, , $delta) = explode('-', $key);
        [, , $delta] = explode('-', $key);
        break;
      }
    }
+1 −1
Changes for src/Feeds/Target/DateTargetBase.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ abstract class DateTargetBase extends FieldTargetBase implements ConfigurableTar
   *   has errors.
   */
  protected function convertToDate($value) {
    $value = trim($value);
    $value = trim((string) $value);

    // This is a year value.
    if (ctype_digit($value) && strlen($value) === 4) {
+1 −1
Changes for src/Feeds/Target/Email.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ class Email extends FieldTargetBase implements ConfigurableTargetInterface {
   * {@inheritdoc}
   */
  protected function prepareValue($delta, array &$values) {
    $values['value'] = trim($values['value']);
    $values['value'] = is_string($values['value']) ? trim($values['value']) : $values['value'];
    if (!filter_var($values['value'], FILTER_VALIDATE_EMAIL)) {
      $values['value'] = '';
    }
+2 −2
Changes for src/Feeds/Target/EntityReference.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ class EntityReference extends FieldTargetBase implements ConfigurableTargetInter
   *   The ID of the new entity or false if the given label is empty.
   */
  protected function createEntity($label) {
    if (!strlen(trim($label))) {
    if (!is_string($label) || !strlen(trim($label))) {
      return FALSE;
    }

@@ -394,7 +394,7 @@ class EntityReference extends FieldTargetBase implements ConfigurableTargetInter
    $delta = 0;
    foreach ($form_state->getValues() as $key => $value) {
      if (strpos($key, 'target-settings-') === 0) {
        list(, , $delta) = explode('-', $key);
        [, , $delta] = explode('-', $key);
        break;
      }
    }
Loading