Make WordPress Core

Changeset 33276


Ignore:
Timestamp:
07/15/2015 04:32:55 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.

See #32165.

File:
1 edited

Legend:

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

    r33259 r33276  
    27182718                    if ( 'byte' === $value['length']['type'] ) {
    27192719                        // Split the CONVERT() calls by charset, so we can make sure the connection is right
    2720                         $queries[ $value['charset'] ][ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING binary ), %d ) USING {$value['charset']} )", $value['value'], $value['length']['length'] );
     2720                        $queries[ $value['charset'] ][ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING binary ), %.0f ) USING {$value['charset']} )", $value['value'], $value['length']['length'] );
    27212721                    } else {
    2722                         $queries[ $value['charset'] ][ $col ] = $this->prepare( "LEFT( CONVERT( %s USING {$value['charset']} ), %d )", $value['value'], $value['length']['length'] );
     2722                        $queries[ $value['charset'] ][ $col ] = $this->prepare( "LEFT( CONVERT( %s USING {$value['charset']} ), %.0f )", $value['value'], $value['length']['length'] );
    27232723                    }
    27242724
Note: See TracChangeset for help on using the changeset viewer.