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/upgrade.php

    r49048 r49108  
    10231023
    10241024        // Add or subtract time to all dates, to get GMT dates.
    1025         $add_hours   = intval( $diff_gmt_weblogger );
    1026         $add_minutes = intval( 60 * ( $diff_gmt_weblogger - $add_hours ) );
     1025        $add_hours   = (int) $diff_gmt_weblogger;
     1026        $add_minutes = (int) ( 60 * ( $diff_gmt_weblogger - $add_hours ) );
    10271027        $wpdb->query( "UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)" );
    10281028        $wpdb->query( "UPDATE $wpdb->posts SET post_modified = post_date" );
     
    20492049    }
    20502050
    2051     $allowed_length = intval( $content_length['length'] ) - 10;
     2051    $allowed_length = (int) $content_length['length'] - 10;
    20522052
    20532053    $comments = $wpdb->get_results(
Note: See TracChangeset for help on using the changeset viewer.