Issue #3087461 by labboy0276: Optimizations to the substr process plugin

(cherry picked from commit 71169689e9)
merge-requests/64/head
Alex Pott 2019-11-02 07:49:05 +01:00
parent ce6f10f79b
commit 79c710773c
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
1 changed files with 2 additions and 3 deletions

View File

@ -75,7 +75,7 @@ class Substr extends ProcessPluginBase {
throw new MigrateException('The start position configuration value should be an integer. Omit this key to capture from the beginning of the string.');
}
$length = isset($this->configuration['length']) ? $this->configuration['length'] : NULL;
if (!is_null($length) && !is_int($length)) {
if ($length !== NULL && !is_int($length)) {
throw new MigrateException('The character length configuration value should be an integer. Omit this key to capture from the start position to the end of the string.');
}
if (!is_string($value)) {
@ -83,8 +83,7 @@ class Substr extends ProcessPluginBase {
}
// Use optional start or length to return a portion of $value.
$new_value = mb_substr($value, $start, $length);
return $new_value;
return mb_substr($value, $start, $length);
}
}