Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #38054


Ignore:
Timestamp:
09/14/2016 01:28:02 PM (5 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #38054 – Description

    initial v1  
    11Hi,
    22
    3 I've simple WP installation and I'm trying to make "my profiler" which will show executing times of all actions. I just found an issue in class.wp-scripts.php. Plugin Query monitor runs  wp_register_script( 'debug-bar', false, array( 'query-monitor') ); inside init action. (it's first call of wp_register_script). Then constructor of WP_Scripts runs add_action( 'init', array( $this, 'init' ), 0 ), but action is already doing and my profiler shows warning about it ($merged_filters['init'] has reset state).
     3I've simple WP installation and I'm trying to make "my profiler" which will show executing times of all actions. I just found an issue in class.wp-scripts.php. Plugin Query monitor runs  `wp_register_script( 'debug-bar', false, array( 'query-monitor') );` inside init action. (it's first call of wp_register_script). Then constructor of WP_Scripts runs `add_action( 'init', array( $this, 'init' ), 0 )`, but action is already doing and my profiler shows warning about it (`$merged_filters['init']` has reset state).
    44
    55I think that constructor should be:
     6{{{
    67        public function __construct() {
    78                $this->init();
    89                if ( ! did_action( 'init' ) ) add_action( 'init', array( $this, 'init' ), 0 );
    910        }
    10 
     11}}}
    1112Sasa