Make WordPress Core

Changeset 36325


Ignore:
Timestamp:
01/15/2016 08:09:08 PM (11 years ago)
Author:
rachelbaker
Message:

Comments: Use TEXT column type in fallback for wp_get_comment_column_max_length().

Fixes #10377.

Location:
trunk
Files:
2 edited

Legend:

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

    r36318 r36325  
    967967                $max_length = (int) $col_length['length'];
    968968        } else {
    969                 $max_length = 255;
     969                // Assume a TEXT column, 65535 - 10.
     970                $max_length = 65525;
    970971        }
    971972
  • trunk/tests/phpunit/tests/comment.php

    r36215 r36325  
    673673                $this->assertSame( 'SHIELD_AGENT', $updated->comment_agent );
    674674        }
     675
     676        public function test_wp_get_comment_column_max_length() {
     677                $columns = array(
     678                        'comment_author' => 245,
     679                        'comment_author_email' => 100,
     680                        'comment_author_url' => 200,
     681                        'comment_author_IP' => 100,
     682                        'comment_content' => 65525,
     683                        'comment_approved' => 20,
     684                        'comment_agent' => 255,
     685                        'comment_type' => 20,
     686                );
     687
     688                foreach ( $columns as $column => $expected ) {
     689                        $max_length = wp_get_comment_column_max_length( $column );
     690                        $this->assertSame( $expected, $max_length );
     691                }
     692        }
    675693}
Note: See TracChangeset for help on using the changeset viewer.