Commit 08595bc1 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4239 (iconv disabling buggy)

parent 1aea73ce
Loading
Loading
Loading
Loading
+1 −1
Changes for docs/pages/comcode_custom/EN/codebook_3.txt: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -555,7 +555,7 @@ We have the following which are either unlikely to be useful, or potentially uns
 - Unsupported functionality
  - [tt]unofficial_ecommerce[/tt] -- set to '1' if your forum driver contains usergroup manipulation functions (we don't support this, but wanted to be able to allow those willing to extend forum drivers to use our full eCommerce framework)
 - Workarounds for difficult server configurations
  - [tt]disable_iconv[/tt] -- set this to '1' if your iconv extension causes PHP to crash
  - [tt]disable_iconv[/tt] -- set this to '1' if your iconv extension causes PHP to crash, or if it is very slow
  - [tt]disable_mbstring[/tt] -- set this to '1' if your mbstring extension causes PHP to crash
  - [tt]prefer_curl[/tt] -- set this to '1' if the server requires you to not use network sockets directly from PHP and instead use the CuRL extension (although if you need this it is likely you actually need to just configure the proxy server options instead)
  - [tt]real_memory_available_mb[/tt] -- set this to the number of MB GD should consider available for image generation, if PHP is lying about its memory limit
+4 −4
Changes for sources/global3.php: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -959,12 +959,12 @@ function cms_mb_strlen($in, $force = false)
    if (!$force && get_charset() != 'utf-8') {
        return strlen($in);
    }
    if ((function_exists('iconv_strlen')) && (get_value('disable_iconv') !== '1')) {
        return @iconv_strlen($in, $force ? 'utf-8' : get_charset());
    }
    if (function_exists('mb_strlen')) {
        return @mb_strlen($in, $force ? 'utf-8' : get_charset()); // @ is because there could be invalid unicode involved
    }
    if (function_exists('iconv_strlen')) {
        return @iconv_strlen($in, $force ? 'utf-8' : get_charset());
    }
    return strlen($in);
}

@@ -991,7 +991,7 @@ function cms_mb_substr($in, $from, $amount = null, $force = false)
        return substr($in, $from, $amount);
    }

    if (function_exists('iconv_substr')) {
    if ((function_exists('iconv_substr')) && (get_value('disable_iconv') !== '1')) {
        return @iconv_substr($in, $from, $amount, $force ? 'utf-8' : get_charset());
    }
    if (function_exists('mb_substr')) {