WordPress.org

Make WordPress Core

Changeset 23074


Ignore:
Timestamp:
12/05/2012 06:57:56 PM (8 years ago)
Author:
nacin
Message:

Script loader: Chunk the script names as passed to load-scripts.php into 128-character pieces. Avoids hitting a limit for the length of a single variable, such as suhosin.get.max_value_length which defaults to 512. fixes #22757.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/load-scripts.php

    r22531 r23074  
    115115}
    116116
    117 $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] );
     117$load = $_GET['load'];
     118if ( is_array( $load ) )
     119    $load = implode( '', $load );
     120
     121$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
    118122$load = explode(',', $load);
    119123
  • trunk/wp-includes/script-loader.php

    r23036 r23074  
    690690        $zip = 'gzip';
    691691
    692     if ( !empty($wp_scripts->concat) ) {
     692    if ( $concat = trim( $wp_scripts->concat, ', ' ) ) {
    693693
    694694        if ( !empty($wp_scripts->print_code) ) {
     
    700700        }
    701701
    702         $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&load=" . trim($wp_scripts->concat, ', ') . '&ver=' . $wp_scripts->default_version;
     702        $concat = str_split( $concat, 128 );
     703        $concat = 'load[]=' . implode( '&load[]=', $concat );
     704
     705        $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&" . $concat . '&ver=' . $wp_scripts->default_version;
    703706        echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n";
    704707    }
Note: See TracChangeset for help on using the changeset viewer.