Changeset 33311
- Timestamp:
- 07/17/2015 07:09:32 AM (9 years ago)
- Location:
- branches/4.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.2/src/wp-includes/wp-db.php
r33309 r33311 2595 2595 if ( is_array( $value['length'] ) ) { 2596 2596 $length = $value['length']['length']; 2597 2597 2598 } else { 2598 2599 $length = false; 2600 2601 2602 2603 2599 2604 } 2600 2605 … … 2608 2613 continue; 2609 2614 } 2610 2611 $truncate_by_byte_length = 'byte' === $value['length']['type'];2612 2615 2613 2616 $needs_validation = true; … … 2684 2687 } 2685 2688 2686 $queries[ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING $charset ), %.0f ) USING {$this->charset} )", $value['value'], $value['length']['length'] ); 2689 if ( is_array( $value['length'] ) ) { 2690 $queries[ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING $charset ), %.0f ) USING {$this->charset} )", $value['value'], $value['length']['length'] ); 2691 } else if ( 'binary' !== $charset ) { 2692 // If we don't have a length, there's no need to convert binary - it will always return the same result. 2693 $queries[ $col ] = $this->prepare( "CONVERT( CONVERT( %s USING $charset ) USING {$this->charset} )", $value['value'] ); 2694 } 2687 2695 2688 2696 unset( $data[ $col ]['db'] ); -
branches/4.2/tests/phpunit/tests/db/charset.php
r33309 r33311 214 214 'expected' => "\xd8ord\xd0ress", 215 215 'length' => array( 'type' => 'char', 'length' => 100 ), 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 216 231 ), 217 232 'cp1251_char_length' => array( … … 808 823 $this->assertEquals( 255, strlen( $stripped ) ); 809 824 } 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 810 842 }
Note: See TracChangeset
for help on using the changeset viewer.