Make WordPress Core

Changeset 61247


Ignore:
Timestamp:
11/14/2025 10:11:11 PM (3 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Cast base_convert() to an integer before arithmetic operations.

Follow-up to [35477], [53104], [56101].

Props justlevine.
See #64238.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r61006 r61247  
    14281428        $menu[] = $new_menu;
    14291429    } elseif ( isset( $menu[ (string) $position ] ) ) {
    1430         $collision_avoider = base_convert( substr( md5( $menu_slug . $menu_title ), -4 ), 16, 10 ) * 0.00001;
     1430        $collision_avoider = (int) base_convert( substr( md5( $menu_slug . $menu_title ), -4 ), 16, 10 ) * 0.00001;
    14311431        $position          = (string) ( $position + $collision_avoider );
    14321432        $menu[ $position ] = $new_menu;
  • trunk/src/wp-includes/class-wp-duotone.php

    r58414 r61247  
    247247                'g' => (int) base_convert( $hex[1] . $hex[1], 16, 10 ),
    248248                'b' => (int) base_convert( $hex[2] . $hex[2], 16, 10 ),
    249                 'a' => 4 === strlen( $hex ) ? round( base_convert( $hex[3] . $hex[3], 16, 10 ) / 255, 2 ) : 1,
     249                'a' => 4 === strlen( $hex ) ? round( (int) base_convert( $hex[3] . $hex[3], 16, 10 ) / 255, 2 ) : 1,
    250250            );
    251251        }
Note: See TracChangeset for help on using the changeset viewer.