WordPress.org

Make WordPress Core

Ticket #41185: 41185.patch

File 41185.patch, 1005 bytes (added by kraftner, 3 years ago)

Test reproducing the bug

  • tests/phpunit/tests/filters.php

     
    380380                global $wp_filter;
    381381                $this->current_priority = $wp_filter[ 'the_content' ]->current_priority();
    382382        }
     383
     384        /**
     385         * @ticket 41185
     386         */
     387        public function test_current_priority_after_nested_add_action(){
     388                add_action( 'test_current_priority', array( $this, '_nested_action' ), 99 );
     389                do_action( 'test_current_priority' );
     390                remove_action( 'test_current_priority', array( $this, '_other_priority_action' ), 99 );
     391                remove_action( 'test_current_priority', array( $this, '_nested_action' ), 100 );
     392
     393                $this->assertSame( 99, $this->current_priority );
     394        }
     395
     396        public function _nested_action() {
     397                add_action( 'test_current_priority', function(){}, 100 );
     398
     399                global $wp_filter;
     400                $this->current_priority = $wp_filter[ current_filter() ]->current_priority();
     401        }
     402
    383403}