Make WordPress Core

Ticket #32051: 32051.3.diff

File 32051.3.diff, 2.4 KB (added by pento, 9 years ago)
  • src/wp-includes/wp-db.php

     
    24622462                $mb_charsets = array(
    24632463                        'ascii'   => 'ASCII',
    24642464                        'big5'    => 'BIG-5',
     2465                        'cp1251'  => 'Windows-1251',
     2466                        'cp866'   => 'CP866',
     2467                        'cp932'   => 'CP932',
    24652468                        'eucjpms' => 'eucJP-win',
     2469                        'euckr'   => 'EUC-KR',
    24662470                        'gb2312'  => 'EUC-CN',
     2471                        'greek'   => 'ISO-8859-7',
     2472                        'hebrew'  => 'ISO-8859-2',
     2473                        'koi8r'   => 'KOI8-R',
     2474                        'latin2'  => 'ISO-8859-2',
     2475                        'latin5'  => 'ISO-8859-9',
     2476                        'latin7'  => 'ISO-8859-13',
     2477                        'sjis'    => 'SJIS',
    24672478                        'ujis'    => 'EUC-JP',
    24682479                        'utf32'   => 'UTF-32',
    24692480                );
     
    25342545
    25352546                if ( $db_check_string ) {
    25362547                        $queries = array();
    2537                         foreach ( $data as $col => $value ) {
     2548                        foreach ( $data as $col => &$value ) {
    25382549                                if ( ! empty( $value['db'] ) ) {
    25392550                                        if ( ! isset( $queries[ $value['charset'] ] ) ) {
    25402551                                                $queries[ $value['charset'] ] = array();
     
    25422553
    25432554                                        // Split the CONVERT() calls by charset, so we can make sure the connection is right
    25442555                                        $queries[ $value['charset'] ][ $col ] = $this->prepare( "CONVERT( %s USING {$value['charset']} )", $value['value'] );
     2556                                        unset( $value['db'] );
    25452557                                }
    25462558                        }
    25472559
  • tests/phpunit/tests/db/charset.php

     
    5555                                'expected' => "H€llo\xf0\x9f\x98\x88World¢"
    5656                        ),
    5757                        'koi8r' => array(
    58                                 // koi8r is a character set that needs to be checked in MySQL
    5958                                'charset'  => 'koi8r',
    6059                                'value'    => "\xfdord\xf2ress",
    6160                                'expected' => "\xfdord\xf2ress",
    62                                 'db'       => true
    6361                        ),
    6462                        'hebrew' => array(
    65                                 // hebrew needs to be checked in MySQL, too
    6663                                'charset'  => 'hebrew',
    6764                                'value'    => "\xf9ord\xf7ress",
    6865                                'expected' => "\xf9ord\xf7ress",
    69                                 'db'       => true
    7066                        ),
     67                        'cp1251' => array(
     68                                'charset'  => 'cp1251',
     69                                'value'    => "\xd8ord\xd0ress",
     70                                'expected' => "\xd8ord\xd0ress",
     71                        ),
     72                        'tis620' => array(
     73                                'charset'  => 'tis620',
     74                                'value'    => "\xccord\xe3ress",
     75                                'expected' => "\xccord\xe3ress",
     76                        ),
    7177                        'false' => array(
    7278                                // false is a column with no character set (ie, a number column)
    7379                                'charset'  => false,