(bug 41146) DatabaseOracle no more rely on mbstring
authorlupo <lupo.bugzilla@gmail.com>
Fri, 16 Nov 2012 12:52:55 +0000 (13:52 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 12 Dec 2012 11:28:28 +0000 (11:28 +0000)
DatabaseOracle class has been using mb_check_encoding which might not
always be available.  We now rely on the StringUtils::isUtf8() method
implemented by I4cf4dfe2.

Change-Id: I5a9ffa23e3e738e4886d61e85974b0af25058308

includes/db/DatabaseOracle.php

index aa4da0f..2f9a05c 100644 (file)
@@ -318,7 +318,7 @@ class DatabaseOracle extends DatabaseBase {
 
        protected function doQuery( $sql ) {
                wfDebug( "SQL: [$sql]\n" );
-               if ( !mb_check_encoding( $sql ) ) {
+               if ( !StringUtils::isUtf8( $sql ) ) {
                        throw new MWException( "SQL encoding is invalid\n$sql" );
                }
 
@@ -1116,7 +1116,7 @@ class DatabaseOracle extends DatabaseBase {
                if ( $col_type == 'CLOB' ) {
                        $col = 'TO_CHAR(' . $col . ')';
                        $val = $wgContLang->checkTitleEncoding( $val );
-               } elseif ( $col_type == 'VARCHAR2' && !mb_check_encoding( $val ) ) {
+               } elseif ( $col_type == 'VARCHAR2' ) {
                        $val = $wgContLang->checkTitleEncoding( $val );
                }
        }