diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/utf8.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/inc/utf8.php b/inc/utf8.php index 273c344c6..e3e7e8c1a 100644 --- a/inc/utf8.php +++ b/inc/utf8.php @@ -91,8 +91,10 @@ if(!function_exists('utf8_basename')){ * @return string */ function utf8_basename($path, $suffix=''){ - $rpos = max(strrpos($path, '/'), strrpos($path, '\\')); - if($rpos) $path = substr($path, $rpos+1); + $slashrpos = strrpos($path, '/'); + $bslashrpos = strrpos($path, '\\'); + $rpos = max($slashrpos === false ? -1 : $slashrpos, $bslashrpos === false ? -1 : $bslashrpos); + $path = substr($path, $rpos+1); $suflen = strlen($suffix); if($suflen && (substr($path, -$suflen) == $suffix)){ |