WordPress.org

Make WordPress Core

Changeset 37911


Ignore:
Timestamp:
06/29/2016 01:21:24 PM (2 years ago)
Author:
ocean90
Message:

Plugins: Return the original value in apply_filters_deprecated() if no filter is registered for the tag.

Props flixos90.
Fixes #10441.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/plugin.php

    r37861 r37911  
    675675function apply_filters_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
    676676    if ( ! has_filter( $tag ) ) {
    677         return;
     677        return $args[0];
    678678    }
    679679
  • trunk/tests/phpunit/tests/filters.php

    r37909 r37911  
    360360        return $p1;
    361361    }
     362
     363    /**
     364     * @ticket 10441
     365     */
     366    public function test_apply_filters_deprecated_without_filter() {
     367        $val = 'Foobar';
     368
     369        $this->assertSame( $val, apply_filters_deprecated( 'tests_apply_filters_deprecated', array( $val ), '4.6' ) );
     370    }
    362371}
Note: See TracChangeset for help on using the changeset viewer.