Making WordPress.org

Changeset 10341


Ignore:
Timestamp:
10/02/2020 04:38:04 AM (4 years ago)
Author:
dd32
Message:

Events API: Base the wordcount on the split text, rather than on the logic of str_word_count() which differs from the utf8 preg_split() result.

This is a super-edge case, as it's mostly bad inputs that seems to cause a problem here.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/index.php

    r10305 r10341  
    667667    // Check if they entered only the country name, e.g. "Germany" or "New Zealand"
    668668    $country             = get_country_from_name( $location_name );
    669     $location_word_count = str_word_count( $location_name );
    670669    $location_name_parts = preg_split( '/\s+/u', $location_name );
     670    $location_word_count = count( $location_name_parts );
    671671
    672672    /*
Note: See TracChangeset for help on using the changeset viewer.