Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to add class method as a sanitized function #1873

Closed
9brada6 opened this issue Mar 18, 2020 · 1 comment
Closed

Possibility to add class method as a sanitized function #1873

9brada6 opened this issue Mar 18, 2020 · 1 comment

Comments

@9brada6
Copy link

9brada6 commented Mar 18, 2020

Is your feature request related to a problem?

✔ If I try to add a function that sanitize my input -> works, without a question.
❌ If I try to add a static method or just a simple class method -> it will not work(Maybe there is a possibility, but I can't find an example).

Describe the solution you'd like

Possibility to add in config class methods to sanitize inputs, something like:

<rule ref="WordPress.Security.ValidatedSanitizedInput">
    <properties>
        <property name="customUnslashingSanitizingFunctions" type="array">
            <element value="sanitize_field"/><!-- This works, other 3 don't -->
            <element value="MY_Custom_Class::sanitize_field"/>
            <element value="MY_Custom_Class->sanitize_field"/>
            <element value="array(MY_Custom_Class, sanitize_field)"/>
        </property>
    </properties>
</rule>

<rule ref="WordPress.Security.NonceVerification">
    <properties>
        <property name="customUnslashingSanitizingFunctions" type="array">
            <element value="sanitize_field"/><!-- This works, other 3 don't -->
            <element value="MY_Custom_Class::sanitize_field"/>
            <element value="MY_Custom_Class->sanitize_field"/>
            <element value="array(MY_Custom_Class, sanitize_field)"/>
        </property>
    </properties>
</rule>
@jrfnl
Copy link
Member

jrfnl commented Mar 18, 2020

Thanks for reporting this, but there's an open feature request for this already.

Closing as duplicate of #413

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants