Skip to:
Content

BuddyPress.org

Ticket #6884: 6884.01.patch

File 6884.01.patch, 856 bytes (added by dcavins, 8 years ago)

Break if any of the values in the array are not whitelisted.

  • src/bp-xprofile/classes/class-bp-xprofile-field-type.php

    diff --git src/bp-xprofile/classes/class-bp-xprofile-field-type.php src/bp-xprofile/classes/class-bp-xprofile-field-type.php
    index 46d412a..c983168 100644
    abstract class BP_XProfile_Field_Type { 
    180180                        $validated = true;
    181181                }
    182182
    183                 // If there's a whitelist set, also check the $value.
     183                // If there's a whitelist set, make sure that each value is a whitelisted value.
    184184                if ( ( true === $validated ) && ! empty( $values ) && ! empty( $this->validation_whitelist ) ) {
    185185                        foreach ( (array) $values as $value ) {
    186                                 $validated = in_array( $value, $this->validation_whitelist, true );
     186                                if ( ! in_array( $value, $this->validation_whitelist, true ) ) {
     187                                        $validated = false;
     188                                        break;
     189                                }
    187190                        }
    188191                }
    189192