Ticket #58458: 58458.patch
File 58458.patch, 2.6 KB (added by , 22 months ago) |
---|
-
src/wp-includes/class-wp-hook.php
27 27 public $callbacks = array(); 28 28 29 29 /** 30 * Hook callbacks keys. 31 * 32 * @since 6.x 33 * @var array 34 */ 35 protected $callbacks_keys = array(); 36 37 /** 30 38 * The priority keys of actively running iterations of a hook. 31 39 * 32 40 * @since 4.7.0 … … 86 94 ksort( $this->callbacks, SORT_NUMERIC ); 87 95 } 88 96 97 98 $this->callbacks_keys = array_keys( $this->callbacks ); 99 89 100 if ( $this->nesting_level > 0 ) { 90 101 $this->resort_active_iterations( $priority, $priority_existed ); 91 102 } … … 102 113 * filter was added. Default false. 103 114 */ 104 115 private function resort_active_iterations( $new_priority = false, $priority_existed = false ) { 105 $new_priorities = array_keys( $this->callbacks );116 $new_priorities = $this->callbacks_keys; 106 117 107 118 // If there are no remaining hooks, clear out all running iterations. 108 119 if ( ! $new_priorities ) { … … 187 198 if ( ! $this->callbacks[ $priority ] ) { 188 199 unset( $this->callbacks[ $priority ] ); 189 200 201 $this->callbacks_keys = array_keys( $this->callbacks ); 202 190 203 if ( $this->nesting_level > 0 ) { 191 204 $this->resort_active_iterations(); 192 205 } … … 263 276 264 277 if ( false === $priority ) { 265 278 $this->callbacks = array(); 279 $this->callbacks_keys = array(); 266 280 } elseif ( isset( $this->callbacks[ $priority ] ) ) { 267 281 unset( $this->callbacks[ $priority ] ); 282 $this->callbacks_keys = array_keys( $this->callbacks ); 268 283 } 269 284 285 270 286 if ( $this->nesting_level > 0 ) { 271 287 $this->resort_active_iterations(); 272 288 } … … 289 305 290 306 $nesting_level = $this->nesting_level++; 291 307 292 $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );308 $this->iterations[ $nesting_level ] = $this->callbacks_keys; 293 309 294 310 $num_args = count( $args ); 295 311 … … 348 364 */ 349 365 public function do_all_hook( &$args ) { 350 366 $nesting_level = $this->nesting_level++; 351 $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );367 $this->iterations[ $nesting_level ] = $this->callbacks_keys; 352 368 353 369 do { 354 370 $priority = current( $this->iterations[ $nesting_level ] ); … … 481 497 } else { 482 498 $this->callbacks[ $offset ] = $value; 483 499 } 500 501 $this->callbacks_keys = array_keys( $this->callbacks ); 484 502 } 485 503 486 504 /** … … 495 513 #[ReturnTypeWillChange] 496 514 public function offsetUnset( $offset ) { 497 515 unset( $this->callbacks[ $offset ] ); 516 $this->callbacks_keys = array_keys( $this->callbacks ); 498 517 } 499 518 500 519 /**