mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #7905 from bummzack/pulls/fix-empty-delimiter
Fix regression in ContextSummary
This commit is contained in:
commit
3cd8c2a985
@ -198,7 +198,7 @@ class DBText extends DBString
|
||||
$keywords = Convert::raw2xml($keywords);
|
||||
|
||||
// Find the search string
|
||||
$position = (int) mb_stripos($text, $keywords);
|
||||
$position = empty($keywords) ? 0 : (int) mb_stripos($text, $keywords);
|
||||
|
||||
// We want to search string to be in the middle of our block to give it some context
|
||||
$position = max(0, $position - ($characters / 2));
|
||||
|
@ -263,6 +263,13 @@ class DBTextTest extends SapphireTest
|
||||
'schön',
|
||||
// check UTF8 support
|
||||
'both <mark>schön</mark> and können...',
|
||||
],
|
||||
[
|
||||
'both schön and können have umlauts',
|
||||
21,
|
||||
'',
|
||||
// check non existant search term
|
||||
'both schön and können...',
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user