Skip to content

Commit

Permalink
Merge pull request #1724 from mcorteel/v2.4.x
Browse files Browse the repository at this point in the history
Use mb_strlen to get string length to avoid unicode characters problems
  • Loading branch information
l3pp4rd authored Dec 14, 2016
2 parents 37d3503 + 94786b0 commit 9ac9111
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Gedmo/Sluggable/Mapping/Event/Adapter/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function replaceRelative($object, array $config, $target, $replacement)
$qb->update($config['useObjectClass'], 'rec')
->set('rec.'.$config['slug'], $qb->expr()->concat(
$qb->expr()->literal($replacement),
$qb->expr()->substring('rec.'.$config['slug'], strlen($target))
$qb->expr()->substring('rec.'.$config['slug'], mb_strlen($target))
))
->where($qb->expr()->like(
'rec.'.$config['slug'],
Expand All @@ -105,7 +105,7 @@ public function replaceInverseRelative($object, array $config, $target, $replace
$qb->update($config['useObjectClass'], 'rec')
->set('rec.'.$config['slug'], $qb->expr()->concat(
$qb->expr()->literal($target),
$qb->expr()->substring('rec.'.$config['slug'], strlen($replacement)+1)
$qb->expr()->substring('rec.'.$config['slug'], mb_strlen($replacement)+1)
))
->where($qb->expr()->like('rec.'.$config['slug'], $qb->expr()->literal($replacement . '%')))
;
Expand Down

0 comments on commit 9ac9111

Please sign in to comment.