@@ -56,10 +56,10 @@ public static function removeDotSegments($input)
56
56
// buffer; otherwise,
57
57
} elseif (StringUtil::startsWith ($ input , '/../ ' )) {
58
58
$ input = substr ($ input , 3 );
59
- $ output = substr_replace ($ output , '' , ( function_exists ( ' \mb_strrpos ' ) ? \mb_strrpos ( $ output , ' / ' ) : \strrpos ($ output , '/ ' ) ));
59
+ $ output = substr_replace ($ output , '' , StringUtil:: reversePosition ($ output , '/ ' ));
60
60
} elseif ($ input === '/.. ' ) {
61
61
$ input = '/ ' ;
62
- $ output = substr_replace ($ output , '' , ( function_exists ( ' \mb_strrpos ' ) ? \mb_strrpos ( $ output , ' / ' ) : \strrpos ($ output , '/ ' ) ));
62
+ $ output = substr_replace ($ output , '' , StringUtil:: reversePosition ($ output , '/ ' ));
63
63
64
64
// D. if the input buffer consists only of "." or "..", then remove
65
65
// that from the input buffer; otherwise,
@@ -70,7 +70,7 @@ public static function removeDotSegments($input)
70
70
// the output buffer, including the initial "/" character (if
71
71
// any) and any subsequent characters up to, but not including,
72
72
// the next "/" character or the end of the input buffer.
73
- } elseif (!(($ pos = ( function_exists ( ' \mb_strpos ' ) ? \mb_strpos ( $ input , ' / ' , 1 ) : \strpos ($ input , '/ ' , 1 ) )) === false )) {
73
+ } elseif (!(($ pos = StringUtil:: position ($ input , '/ ' , 1 )) === false )) {
74
74
$ output .= substr ($ input , 0 , $ pos );
75
75
$ input = substr_replace ($ input , '' , 0 , $ pos );
76
76
} else {
@@ -131,7 +131,7 @@ private function absolutizeUrl()
131
131
if (StringUtil::startsWith ($ r ['path ' ], '/ ' )) {
132
132
$ target ['path ' ] = self ::removeDotSegments ($ r ['path ' ]);
133
133
} else {
134
- $ base = ( function_exists ( ' \mb_strrchr ' ) ? \mb_strrchr ( $ b ['path ' ], '/ ' , true ) : \strrchr ( $ b [ ' path ' ], ' / ' ) );
134
+ $ base = StringUtil:: characterReversePosition ( $ b ['path ' ], '/ ' , true );
135
135
if ($ base === false ) {
136
136
$ base = '' ;
137
137
}
0 commit comments