Correctly interpret result of strpos(…)

if `%s` happens to be at the start of the string then `strpos(…, '%s')` returns `0`. That evaluates to false in an `if` statement. Thus the replacement will not be applied in that case.
See https://github.com/splitbrain/dokuwiki/pull/3790 for a probable similar issue.
This commit is contained in:
fiwswe 2022-10-09 16:30:41 +02:00 committed by GitHub
parent f6194cf4db
commit 2e98afbd63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,7 +45,7 @@ class tpl {
$linktarget = wl($data['id'], $data['params'], false, '&');
}
$caption = $lang['btn_' . $data['type']];
if(strpos($caption, '%s')) {
if(strpos($caption, '%s') !== false) {
$caption = sprintf($caption, $data['replacement']);
}