Skip to:
Content

BuddyPress.org

Changeset 13793


Ignore:
Timestamp:
04/12/2024 01:28:59 PM (8 months ago)
Author:
espellcaste
Message:

Cast values used in the ctype_digit function to a string.

Argument of type int will be interpreted as string in the future.

Closes https://github.com/buddypress/buddypress/pull/265
See #8649
Fixes #9125

Location:
trunk/src/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-attachments.php

    r13468 r13793  
    15741574    }
    15751575
    1576     if ( empty( $_POST['object'] ) || empty( $_POST['item_id'] ) || ( ! ctype_digit( $_POST['item_id'] ) && ! is_int( $_POST['item_id'] ) ) ) {
     1576    if ( empty( $_POST['object'] ) || empty( $_POST['item_id'] ) || ( ! ctype_digit( (string) $_POST['item_id'] ) && ! is_int( $_POST['item_id'] ) ) ) {
    15771577        wp_send_json_error();
    15781578    }
  • trunk/src/bp-core/classes/class-bp-media-extractor.php

    r13508 r13793  
    778778
    779779                // A width was specified but not a height, so calculate it assuming a 4:3 ratio.
    780                 if ( ! isset( $extra_args['height'] ) && ctype_digit( $extra_args['width'] ) ) {
     780                if ( ! isset( $extra_args['height'] ) && ctype_digit( (string) $extra_args['width'] ) ) {
    781781                    $extra_args['height'] = round( ( $extra_args['width'] / 4 ) * 3 );
    782782                }
    783783
    784                 if ( ctype_digit( $extra_args['width'] ) ) {
     784                if ( ctype_digit( (string) $extra_args['width'] ) ) {
    785785                    $image_size = array( $extra_args['width'], $extra_args['height'] );
    786786                } else {
     
    877877            // Validate the size of the images requested.
    878878            if ( isset( $extra_args['width'] ) ) {
    879                 if ( ! isset( $extra_args['height'] ) && ctype_digit( $extra_args['width'] ) ) {
     879                if ( ! isset( $extra_args['height'] ) && ctype_digit( (string) $extra_args['width'] ) ) {
    880880                    // A width was specified but not a height, so calculate it assuming a 4:3 ratio.
    881881                    $extra_args['height'] = round( ( $extra_args['width'] / 4 ) * 3 );
    882882                }
    883883
    884                 if ( ctype_digit( $extra_args['width'] ) ) {
     884                if ( ctype_digit( (string) $extra_args['width'] ) ) {
    885885                    $image_size = array( $extra_args['width'], $extra_args['height'] );
    886886                } else {
Note: See TracChangeset for help on using the changeset viewer.