[wp-trac] [WordPress Trac] #34585: Updating via $wpdb->update fails when using Chinese Characters, depending on the characters postion in the string

WordPress Trac noreply at wordpress.org
Wed Nov 4 19:01:46 UTC 2015


#34585: Updating via $wpdb->update fails when using Chinese Characters, depending
on the characters postion in the string
--------------------------+-----------------------------
 Reporter:  while1        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  4.3.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Update Fails for:

 {{{#!php
 <?php
 $wpdb->update($table, array('value' => $struct_title,'xml_data' =>
 $data,),array('ID' => $update_id));
 }}}


 no Update in Database. But is working using $wpdb->prepared():

 {{{#!php
 <?php
 $wpdb->query($wpdb->prepare("UPDATE $table SET xml_data=%s WHERE
 ID='$update_id' ",$data));
 }}}

 I guess it's a encoding/transfer problem in the WP-Database Layer when
 using $wpdb->update().

 - All UTF-8 / also used UTF-8 Fix Iconv from W3C.
 - pasting the same string in PHPMyAdmin works

 for more information or a source code to a test case feel free to contact
 me.

 I Attached File with a text string reproducing the bug. Moving the Chinese
 characters by new spaces or regular characters makes the string work in
 $wdpd->update or not.

 for now the $wpdb->query solution works for me but i prefer using the
 $wpdb->update method.

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


More information about the wp-trac mailing list