From 49ababac08dfc8e901c78eca97a95c0c83654613 Mon Sep 17 00:00:00 2001 From: Hugues Peccatte Date: Sat, 4 Oct 2014 10:09:06 +0200 Subject: [PATCH] Replace mb functions by standard string functions. Signed-off-by: Hugues Peccatte --- changelog.php | 2 +- gis_data_editor.php | 2 +- import.php | 14 +++++++------- index.php | 2 +- libraries/Advisor.class.php | 2 +- libraries/Config.class.php | 10 +++++----- transformation_wrapper.php | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/changelog.php b/changelog.php index a7287f032c..5066ffe03e 100644 --- a/changelog.php +++ b/changelog.php @@ -23,7 +23,7 @@ $filename = CHANGELOG_FILE; if (is_readable($filename)) { // Test if the if is in a compressed format - if (/*overload*/mb_substr($filename, -3) == '.gz') { + if (substr($filename, -3) == '.gz') { ob_start(); readgzfile($filename); $changelog = ob_get_contents(); diff --git a/gis_data_editor.php b/gis_data_editor.php index 66a0814359..f14e4662d2 100644 --- a/gis_data_editor.php +++ b/gis_data_editor.php @@ -50,7 +50,7 @@ if (! isset($gis_data['gis_type'])) { $gis_data['gis_type'] = /*overload*/mb_strtoupper($_REQUEST['type']); } if (isset($_REQUEST['value']) && trim($_REQUEST['value']) != '') { - $start = (/*overload*/mb_substr($_REQUEST['value'], 0, 1) == "'") ? 1 : 0; + $start = (substr($_REQUEST['value'], 0, 1) == "'") ? 1 : 0; $gis_data['gis_type'] = /*overload*/mb_substr( $_REQUEST['value'], $start, diff --git a/import.php b/import.php index 3561e42c3f..f0e13e4c8e 100644 --- a/import.php +++ b/import.php @@ -392,13 +392,13 @@ if ($memory_limit == -1) { } // Calculate value of the limit -if (/*overload*/mb_strtolower(/*overload*/mb_substr($memory_limit, -1)) == 'm') { - $memory_limit = (int)/*overload*/mb_substr($memory_limit, 0, -1) * 1024 * 1024; -} elseif (/*overload*/mb_strtolower(/*overload*/mb_substr($memory_limit, -1)) == 'k') { - $memory_limit = (int)/*overload*/mb_substr($memory_limit, 0, -1) * 1024; -} elseif (/*overload*/mb_strtolower(/*overload*/mb_substr($memory_limit, -1)) == 'g') { - $memory_limit - = (int)/*overload*/mb_substr($memory_limit, 0, -1) * 1024 * 1024 * 1024; +$memoryUnit = /*overload*/mb_strtolower(substr($memory_limit, -1)); +if ('m' == $memoryUnit) { + $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024; +} elseif ('k' == $memoryUnit) { + $memory_limit = (int)substr($memory_limit, 0, -1) * 1024; +} elseif ('g' == $memoryUnit) { + $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024; } else { $memory_limit = (int)$memory_limit; } diff --git a/index.php b/index.php index 95019984ff..0e90e75aae 100644 --- a/index.php +++ b/index.php @@ -563,7 +563,7 @@ if (isset($GLOBALS['dbi']) $_client_info = $GLOBALS['dbi']->getClientInfo(); if ($server > 0 && /*overload*/mb_strpos($_client_info, 'mysqlnd') === false - && substr(PMA_MYSQL_CLIENT_API, 0, 3) != mb_substr( + && substr(PMA_MYSQL_CLIENT_API, 0, 3) != substr( PMA_MYSQL_INT_VERSION, 0, 3 ) ) { diff --git a/libraries/Advisor.class.php b/libraries/Advisor.class.php index 5acb759ead..75b0c4a9f3 100644 --- a/libraries/Advisor.class.php +++ b/libraries/Advisor.class.php @@ -389,7 +389,7 @@ class Advisor } // Reading new rule - if (/*overload*/mb_substr($line, 0, 4) == 'rule') { + if (substr($line, 0, 4) == 'rule') { if ($ruleLine > 0) { $errors[] = sprintf( __( diff --git a/libraries/Config.class.php b/libraries/Config.class.php index 136c10b89e..d5d51f53e2 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -437,7 +437,7 @@ class PMA_Config //@TODO Implement strstr in PMA_String if (/*overload*/mb_strstr($ref_head, '/')) { $ref_head = /*overload*/mb_substr(trim($ref_head), 5); - if (/*overload*/mb_substr($ref_head, 0, 11) === 'refs/heads/') { + if (substr($ref_head, 0, 11) === 'refs/heads/') { $branch = /*overload*/mb_substr($ref_head, 11); } else { $branch = basename($ref_head); @@ -507,7 +507,7 @@ class PMA_Config // packs. (to look for them in .git/object/pack directory later) foreach (explode("\n", $packs) as $line) { // skip blank lines - if (/*overload*/mb_strlen(trim($line)) == 0) { + if (strlen(trim($line)) == 0) { continue; } // skip non pack lines @@ -530,7 +530,7 @@ class PMA_Config $file_name = $file_info->getFilename(); // if this is a .pack file if ($file_info->isFile() - && /*overload*/mb_substr($file_name, -5) == '.pack' + && substr($file_name, -5) == '.pack' ) { $pack_names[] = $file_name; } @@ -782,7 +782,7 @@ class PMA_Config $httpOk = 'HTTP/1.1 200 OK'; $httpNotFound = 'HTTP/1.1 404 Not Found'; - if (/*overload*/mb_substr($data, 0, strlen($httpOk)) === $httpOk) { + if (substr($data, 0, strlen($httpOk)) === $httpOk) { return $get_body ? /*overload*/mb_substr( $data, @@ -791,7 +791,7 @@ class PMA_Config : true; } - $httpNOK = /*overload*/mb_substr( + $httpNOK = substr( $data, 0, strlen($httpNotFound) diff --git a/transformation_wrapper.php b/transformation_wrapper.php index ac9b272dee..ac0b04973d 100644 --- a/transformation_wrapper.php +++ b/transformation_wrapper.php @@ -77,7 +77,7 @@ if ($cfgRelation['commwork'] && $cfgRelation['mimework']) { ); foreach ($mime_options as $key => $option) { - if (/*overload*/mb_substr($option, 0, 10) == '; charset=') { + if (substr($option, 0, 10) == '; charset=') { $mime_options['charset'] = $option; } }