Changeset 33479
- Timestamp:
- 07/29/2015 06:45:12 AM (9 years ago)
- Location:
- branches/4.1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.1/src/wp-includes/wp-db.php
r33478 r33479 2571 2571 if ( is_array( $value['length'] ) ) { 2572 2572 $length = $value['length']['length']; 2573 2573 2574 } else { 2574 2575 $length = false; 2576 2577 2578 2579 2575 2580 } 2576 2581 … … 2584 2589 continue; 2585 2590 } 2586 2587 $truncate_by_byte_length = 'byte' === $value['length']['type'];2588 2591 2589 2592 $needs_validation = true; … … 2660 2663 } 2661 2664 2662 $queries[ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING $charset ), %.0f ) USING {$this->charset} )", $value['value'], $value['length']['length'] ); 2665 if ( is_array( $value['length'] ) ) { 2666 $queries[ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING $charset ), %.0f ) USING {$this->charset} )", $value['value'], $value['length']['length'] ); 2667 } else if ( 'binary' !== $charset ) { 2668 // If we don't have a length, there's no need to convert binary - it will always return the same result. 2669 $queries[ $col ] = $this->prepare( "CONVERT( CONVERT( %s USING $charset ) USING {$this->charset} )", $value['value'] ); 2670 } 2663 2671 2664 2672 unset( $data[ $col ]['db'] ); -
branches/4.1/tests/phpunit/tests/db/charset.php
r33478 r33479 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( … … 804 819 $this->assertEquals( 255, strlen( $stripped ) ); 805 820 } 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 806 838 }
Note: See TracChangeset
for help on using the changeset viewer.