summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-07-29 10:45:53 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-07-29 10:46:22 +0200
commit420addb2e4aefb77d089e776672d40c18f86b2ac (patch)
treee2f09417e61fe2a82d6f523a514236730f462ecd /inc
parent00c2d4a9d8fcb38b6a2294749b395d528952fde5 (diff)
downloadrpg-420addb2e4aefb77d089e776672d40c18f86b2ac.tar.gz
rpg-420addb2e4aefb77d089e776672d40c18f86b2ac.tar.bz2
fix utf8_basename for file names without any directory
Diffstat (limited to 'inc')
-rw-r--r--inc/utf8.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/inc/utf8.php b/inc/utf8.php
index 227fa830a..273c344c6 100644
--- a/inc/utf8.php
+++ b/inc/utf8.php
@@ -92,14 +92,14 @@ if(!function_exists('utf8_basename')){
*/
function utf8_basename($path, $suffix=''){
$rpos = max(strrpos($path, '/'), strrpos($path, '\\'));
- $file = substr($path, $rpos+1);
+ if($rpos) $path = substr($path, $rpos+1);
$suflen = strlen($suffix);
- if($suflen && (substr($file, -$suflen) == $suffix)){
- $file = substr($file, 0, -$suflen);
+ if($suflen && (substr($path, -$suflen) == $suffix)){
+ $path = substr($path, 0, -$suflen);
}
- return $file;
+ return $path;
}
}