Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/19/2016 02:51:45 AM (9 years ago)
Author:
boonebgorges
Message:

XProfile: Only cache field object when query is successful.

Previously, a PHP notice was being thrown when a bad $field_id was passed
to BP_XProfile_Field::get_instance().

Props mmcachran.
Fixes #7073.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/xprofile/class-bp-xprofile-field.php

    r10164 r10778  
    175175        $this->assertSame( $num_queries, $wpdb->num_queries );
    176176    }
     177
     178    /**
     179     * @ticket BP7073
     180     */
     181    public function test_bad_field_id_should_not_be_cached() {
     182        BP_XProfile_Field::get_instance( 12345 );
     183
     184        $this->assertFalse( wp_cache_get( 12345, 'bp_xprofile_fields' ) );
     185    }
    177186}
Note: See TracChangeset for help on using the changeset viewer.