Make WordPress Core


Ignore:
Timestamp:
07/15/2015 04:39:19 AM (9 years ago)
Author:
pento
Message:

WPDB: When checking that text isn't too long to insert into a column, LONGTEXT columns could fail, as their length is longer than PHP_INT_MAX. Treating their length as a float instead of an int fixes this.

Merge of [33276] to the 4.2 branch.

See #32165.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/src/wp-includes/wp-db.php

    r33260 r33277  
    26832683                    if ( 'byte' === $value['length']['type'] ) {
    26842684                        // Split the CONVERT() calls by charset, so we can make sure the connection is right
    2685                         $queries[ $value['charset'] ][ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING binary ), %d ) USING {$value['charset']} )", $value['value'], $value['length']['length'] );
     2685                        $queries[ $value['charset'] ][ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING binary ), %.0f ) USING {$value['charset']} )", $value['value'], $value['length']['length'] );
    26862686                    } else {
    2687                         $queries[ $value['charset'] ][ $col ] = $this->prepare( "LEFT( CONVERT( %s USING {$value['charset']} ), %d )", $value['value'], $value['length']['length'] );
     2687                        $queries[ $value['charset'] ][ $col ] = $this->prepare( "LEFT( CONVERT( %s USING {$value['charset']} ), %.0f )", $value['value'], $value['length']['length'] );
    26882688                    }
    26892689
Note: See TracChangeset for help on using the changeset viewer.