Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/22/2016 10:32:06 PM (8 years ago)
Author:
r-a-y
Message:

Messages: Cast properties as integers where appropriate.

See #6977.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/classes/class-bp-messages-notice.php

    r10421 r11028  
    6363    public function __construct( $id = null ) {
    6464        if ( $id ) {
    65             $this->id = $id;
     65            $this->id = (int) $id;
    6666            $this->populate();
    6767        }
     
    8686            $this->message   = $notice->message;
    8787            $this->date_sent = $notice->date_sent;
    88             $this->is_active = $notice->is_active;
     88            $this->is_active = (int) $notice->is_active;
    8989        }
    9090    }
     
    233233        $notices = $wpdb->get_results( "SELECT * FROM {$bp->messages->table_name_notices} ORDER BY date_sent DESC {$limit_sql}" );
    234234
     235        // Integer casting.
     236        foreach ( (array) $notices as $key => $data ) {
     237            $notices[ $key ]->id        = (int) $notices[ $key ]->id;
     238            $notices[ $key ]->is_active = (int) $notices[ $key ]->is_active;
     239        }
     240
    235241        return $notices;
    236242    }
Note: See TracChangeset for help on using the changeset viewer.