Make WordPress Core


Ignore:
Timestamp:
10/08/2020 09:13:57 PM (4 years ago)
Author:
SergeyBiryukov
Message:

General: Replace older-style PHP type conversion functions with type casts.

This improves performance, readability, and consistency throughout core.

  • intval()(int)
  • strval()(string)
  • floatval()(float)

Props ayeshrajans.
Fixes #42918.

File:
1 edited

Legend:

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

    r49021 r49108  
    19241924
    19251925        if ( isset( $_POST['_thumbnail_id'] ) ) {
    1926             $query_args['_thumbnail_id'] = ( intval( $_POST['_thumbnail_id'] ) <= 0 ) ? '-1' : intval( $_POST['_thumbnail_id'] );
     1926            $query_args['_thumbnail_id'] = ( (int) $_POST['_thumbnail_id'] <= 0 ) ? '-1' : (int) $_POST['_thumbnail_id'];
    19271927        }
    19281928    }
     
    20862086
    20872087        if ( ! empty( $_term ) ) {
    2088             $clean_terms[] = intval( $_term[0] );
     2088            $clean_terms[] = (int) $_term[0];
    20892089        } else {
    20902090            // No existing term was found, so pass the string. A new term will be created.
Note: See TracChangeset for help on using the changeset viewer.