Skip to content

Commit

Permalink
handle case: ErrorException: strpos(): Empty needle
Browse files Browse the repository at this point in the history
  • Loading branch information
pepijnolivier committed Aug 23, 2017
1 parent 9488669 commit 2e6780a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Repositories/Modules/ModuleTranslationsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ private function sanitizeDbMatches($key, array $dbMatches)
{
$sanitized = [];
foreach($dbMatches as $dbKey => $value) {
// handle case: ErrorException: strpos(): Empty needle
if(empty($key) || empty($dbKey)) {
continue;
}

$value = (string) $value; // handle NULL
$sanitizedKey = str_replace_first($key, '' , $dbKey);
$sanitizedKey = ltrim($sanitizedKey, '.'); // remove leading dots
Expand Down

0 comments on commit 2e6780a

Please sign in to comment.