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.1 branch.

See #32165.


Built from https://develop.svn.wordpress.org/branches/4.1@33477


git-svn-id: http://core.svn.wordpress.org/branches/4.1@33444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2015-07-29 06:29:22 +00:00
parent fae5374051
commit eb9a250ae8
1 changed files with 2 additions and 2 deletions

View File

@ -2658,9 +2658,9 @@ class wpdb {
// We're going to need to truncate by characters or bytes, depending on the length value we have.
if ( 'byte' === $value['length']['type'] ) {
// Split the CONVERT() calls by charset, so we can make sure the connection is right
$queries[ $value['charset'] ][ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING binary ), %d ) USING {$value['charset']} )", $value['value'], $value['length']['length'] );
$queries[ $value['charset'] ][ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING binary ), %.0f ) USING {$value['charset']} )", $value['value'], $value['length']['length'] );
} else {
$queries[ $value['charset'] ][ $col ] = $this->prepare( "LEFT( CONVERT( %s USING {$value['charset']} ), %d )", $value['value'], $value['length']['length'] );
$queries[ $value['charset'] ][ $col ] = $this->prepare( "LEFT( CONVERT( %s USING {$value['charset']} ), %.0f )", $value['value'], $value['length']['length'] );
}
unset( $data[ $col ]['db'] );