* PHP extensions may be included here.
*/
-if ( !function_exists( 'mb_substr' ) ) {
- /**
- * @codeCoverageIgnore
- * @see Fallback::mb_substr
- * @return string
- */
- function mb_substr( $str, $start, $count = 'end' ) {
- return Fallback::mb_substr( $str, $start, $count );
- }
-
- /**
- * @codeCoverageIgnore
- * @see Fallback::mb_substr_split_unicode
- * @return int
- */
- function mb_substr_split_unicode( $str, $splitPos ) {
- return Fallback::mb_substr_split_unicode( $str, $splitPos );
- }
-}
-
-if ( !function_exists( 'mb_strlen' ) ) {
- /**
- * @codeCoverageIgnore
- * @see Fallback::mb_strlen
- * @return int
- */
- function mb_strlen( $str, $enc = '' ) {
- return Fallback::mb_strlen( $str, $enc );
- }
-}
-
-if ( !function_exists( 'mb_strpos' ) ) {
- /**
- * @codeCoverageIgnore
- * @see Fallback::mb_strpos
- * @return int
- */
- function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
- return Fallback::mb_strpos( $haystack, $needle, $offset, $encoding );
- }
-}
-
-if ( !function_exists( 'mb_strrpos' ) ) {
- /**
- * @codeCoverageIgnore
- * @see Fallback::mb_strrpos
- * @return int
- */
- function mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
- return Fallback::mb_strrpos( $haystack, $needle, $offset, $encoding );
- }
-}
-
// hash_equals function only exists in PHP >= 5.6.0
// http://php.net/hash_equals
if ( !function_exists( 'hash_equals' ) ) {
$query = wfArrayToCgi( $query );
}
if ( $query != '' ) {
+ // Remove the fragment, if there is one
+ $fragment = false;
+ $hashPos = strpos( $url, '#' );
+ if ( $hashPos !== false ) {
+ $fragment = substr( $url, $hashPos );
+ $url = substr( $url, 0, $hashPos );
+ }
+
+ // Add parameter
if ( false === strpos( $url, '?' ) ) {
$url .= '?';
} else {
$url .= '&';
}
$url .= $query;
+
+ // Put the fragment back
+ if ( $fragment !== false ) {
+ $url .= $fragment;
+ }
}
return $url;
}
/**
* @deprecated since 1.27, PHP's session generation isn't used with
- * MediaWiki\\Session\\SessionManager
+ * MediaWiki\Session\SessionManager
*/
function wfFixSessionID() {
wfDeprecated( __FUNCTION__, '1.27' );
/**
* Reset the session id
*
- * @deprecated since 1.27, use MediaWiki\\Session\\SessionManager instead
+ * @deprecated since 1.27, use MediaWiki\Session\SessionManager instead
* @since 1.22
*/
function wfResetSessionID() {
/**
* Initialise php session
*
- * @deprecated since 1.27, use MediaWiki\\Session\\SessionManager instead.
+ * @deprecated since 1.27, use MediaWiki\Session\SessionManager instead.
* Generally, "using" SessionManager will be calling ->getSessionById() or
* ::getGlobalSession() (depending on whether you were passing $sessionId
* here), then calling $session->persist().