Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/26/2016 07:56:30 PM (9 years ago)
Author:
dcavins
Message:

Use absint() to validate numeric input in the WP Customizer.

intval() fails when used with the WP
Customizer API as a sanitization callback.
The callback function is attached to
a filter in WP_Customize_Setting::sanitize()
that passes two arguments to the
sanitization callback: the $value to sanitize
and the instance of WP_Customize_Setting.
Since intval() can accept an optional
second argument ($base), but isn’t
expecting an object, it fails.
absint() works because it is only
expecting the $value argument.

Fixes #7041.

Props WeddyWood.

File:
1 edited

Legend:

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

    r10652 r10814  
    195195            'capability'        => 'bp_moderate',
    196196            'default'           => $defaults['header_text_size'],
    197             'sanitize_callback' => 'intval',
     197            'sanitize_callback' => 'absint',
    198198            'transport'         => 'postMessage',
    199199            'type'              => 'option',
     
    223223            'capability'        => 'bp_moderate',
    224224            'default'           => $defaults['body_text_size'],
    225             'sanitize_callback' => 'intval',
     225            'sanitize_callback' => 'absint',
    226226            'transport'         => 'postMessage',
    227227            'type'              => 'option',
     
    251251            'capability'        => 'bp_moderate',
    252252            'default'           => $defaults['footer_text_size'],
    253             'sanitize_callback' => 'intval',
     253            'sanitize_callback' => 'absint',
    254254            'transport'         => 'postMessage',
    255255            'type'              => 'option',
Note: See TracChangeset for help on using the changeset viewer.