[wp-trac] [WordPress Trac] #32105: Database collate should be utf8mb4_unicode_520_ci

WordPress Trac noreply at wordpress.org
Fri Apr 24 10:33:34 UTC 2015


#32105: Database collate should be utf8mb4_unicode_520_ci
--------------------------+-----------------------------
 Reporter:  miyauchi      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If the collate is utf8mb4_unicode_ci, All the 4 byte characters are
 recognized that they are identical.

 For example, I set a sushi at line 16 and when searching for a beer, it's
 not null.
 https://gist.github.com/miya0001/91c837a1d3a0b75cd233

 {{{
 <?php

 class SampleTest extends WP_UnitTestCase {

         /**
          * @test
          */
         function utf8_test()
         {
                 global $wp_version;
                 global $wpdb;

                 $this->assertSame( '4.2', $wp_version );

                 // post_title is sushi
                 $post_id = $this->factory->post->create( array(
 'post_title' => '🍣' ) );

                 // search by beer
                 $result = $wpdb->get_var( $wpdb->prepare(
                     "SELECT ID FROM $wpdb->posts where post_title=%s",
 '🍺'
                 ) );

                 // It should be null but 3
                 $this->assertSame( NULL, $result ); // fail
         }


 }


 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32105>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list