WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/12/2016 01:54:50 PM (6 years ago)
Author:
rachelbaker
Message:

Comments: Change wp_get_comment_column_max_length() function to wp_get_comment_fields_max_lengths() for consolidation and better fallbacks.

Instead of returning a value for each of the related table column lengths, return an array of all of the column lengths used in the comment form.
Better fallback handling, where each field falls back to the expected max_length instead of an arbitrary number.

Props azaozz.

Fixes #10377.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment.php

    r36325 r36514  
    674674    }
    675675
    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     }
    693676}
Note: See TracChangeset for help on using the changeset viewer.