WordPress.org

Make WordPress Core

Ticket #44979: 44979.diff

File 44979.diff, 4.3 KB (added by killerbishop, 3 months ago)

Patch for 44979 - Switch from pass-by-ref on wp_default_styles() and wp_default_scripts()

  • src/wp-admin/includes/noop.php

    diff --git a/src/wp-admin/includes/noop.php b/src/wp-admin/includes/noop.php
    index 134bef7efe..ff1a66e042 100644
    a b function did_action() {} 
    5555/**
    5656 * @ignore
    5757 */
    58 function do_action_ref_array() {}
     58function do_action() {}
    5959
    6060/**
    6161 * @ignore
  • src/wp-includes/class.wp-scripts.php

    diff --git a/src/wp-includes/class.wp-scripts.php b/src/wp-includes/class.wp-scripts.php
    index 2df22b905a..6c5aa5a83e 100644
    a b public function init() { 
    143143                 *
    144144                 * @since 2.6.0
    145145                 *
    146                  * @param WP_Scripts $this WP_Scripts instance (passed by reference).
     146                 * @param WP_Scripts $this WP_Scripts instance.
    147147                 */
    148                 do_action_ref_array( 'wp_default_scripts', array( &$this ) );
     148                do_action( 'wp_default_scripts', $this );
    149149        }
    150150
    151151        /**
  • src/wp-includes/class.wp-styles.php

    diff --git a/src/wp-includes/class.wp-styles.php b/src/wp-includes/class.wp-styles.php
    index f8bdd830dd..ec220f8927 100644
    a b public function __construct() { 
    111111                 *
    112112                 * @since 2.6.0
    113113                 *
    114                  * @param WP_Styles $this WP_Styles instance (passed by reference).
     114                 * @param WP_Styles $this WP_Styles instance.
    115115                 */
    116                 do_action_ref_array( 'wp_default_styles', array( &$this ) );
     116                do_action( 'wp_default_styles', $this );
    117117        }
    118118
    119119        /**
  • src/wp-includes/script-loader.php

    diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
    index ec412c0969..efff634a0d 100644
    a b  
    4141 *
    4242 * @param WP_Scripts $scripts WP_Scripts object.
    4343 */
    44 function wp_register_tinymce_scripts( &$scripts, $force_uncompressed = false ) {
     44function wp_register_tinymce_scripts( WP_Scripts $scripts, $force_uncompressed = false ) {
    4545        global $tinymce_version, $concatenate_scripts, $compress_scripts;
    4646        $suffix     = wp_scripts_get_suffix();
    4747        $dev_suffix = wp_scripts_get_suffix( 'dev' );
    function wp_register_tinymce_scripts( &$scripts, $force_uncompressed = false ) { 
    7373 *
    7474 * @param WP_Scripts $scripts WP_Scripts object.
    7575 */
    76 function wp_default_packages_vendor( &$scripts ) {
     76function wp_default_packages_vendor( WP_Scripts $scripts ) {
    7777        global $wp_locale;
    7878
    7979        $suffix = wp_scripts_get_suffix();
    function wp_default_packages_vendor( &$scripts ) { 
    170170 * @param array      $tests   Features to detect.
    171171 * @return string Conditional polyfill inline script.
    172172 */
    173 function wp_get_script_polyfill( &$scripts, $tests ) {
     173function wp_get_script_polyfill( WP_Scripts $scripts, $tests ) {
    174174        $polyfill = '';
    175175        foreach ( $tests as $test => $handle ) {
    176176                if ( ! array_key_exists( $handle, $scripts->registered ) ) {
    function wp_get_script_polyfill( &$scripts, $tests ) { 
    220220 *
    221221 * @param WP_Scripts $scripts WP_Scripts object.
    222222 */
    223 function wp_default_packages_scripts( &$scripts ) {
     223function wp_default_packages_scripts( WP_Scripts $scripts ) {
    224224        $suffix = wp_scripts_get_suffix();
    225225
    226226        $packages_versions = array(
    function wp_default_packages_scripts( &$scripts ) { 
    527527 *
    528528 * @param WP_Scripts $scripts WP_Scripts object.
    529529 */
    530 function wp_default_packages_inline_scripts( &$scripts ) {
     530function wp_default_packages_inline_scripts( WP_Scripts $scripts ) {
    531531        global $wp_locale;
    532532
    533533        if ( isset( $scripts->registered['wp-api-fetch'] ) ) {
    function wp_tinymce_inline_scripts() { 
    783783 *
    784784 * @param WP_Scripts $scripts WP_Scripts object.
    785785 */
    786 function wp_default_packages( &$scripts ) {
     786function wp_default_packages( WP_Scripts $scripts ) {
    787787        wp_default_packages_vendor( $scripts );
    788788        wp_register_tinymce_scripts( $scripts );
    789789        wp_default_packages_scripts( $scripts );
    function wp_scripts_get_suffix( $type = '' ) { 
    841841 *
    842842 * @param WP_Scripts $scripts WP_Scripts object.
    843843 */
    844 function wp_default_scripts( &$scripts ) {
     844function wp_default_scripts( WP_Scripts $scripts ) {
    845845        $suffix     = wp_scripts_get_suffix();
    846846        $dev_suffix = wp_scripts_get_suffix( 'dev' );
    847847        $guessurl   = site_url();
    function wp_default_scripts( &$scripts ) { 
    18771877 *
    18781878 * @param WP_Styles $styles
    18791879 */
    1880 function wp_default_styles( &$styles ) {
     1880function wp_default_styles( WP_Styles $styles ) {
    18811881        include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
    18821882
    18831883        if ( ! defined( 'SCRIPT_DEBUG' ) ) {